Package jsky.catalog

Examples of jsky.catalog.Catalog


            urlStr = _getQueryUrl(urlStr, queryArgs); // allan 20.02.09 moved up one line
            StringTokenizer token = new StringTokenizer(urlStr.substring(7), "?\t");
            String className = token.nextToken();
            try {
                Class catalogClass = Class.forName(className);
                Catalog catalog = (Catalog) catalogClass.newInstance();
                result = catalog.query(queryArgs);
                if (result instanceof MemoryCatalog && !(result instanceof SkycatTable)) {
                    MemoryCatalog mcat = (MemoryCatalog) result;
                    result = new SkycatTable(_entry, mcat.getDataVector(), mcat.getFields());
                }
            } catch (Exception e) {
View Full Code Here


            System.out.println("usage: java -classpath ... SkycatCatalog catalogName");
            System.exit(1);
        }
        String catalogName = args[0];
        SkycatConfigFile configFile = SkycatConfigFile.getConfigFile();
        Catalog cat = configFile.getCatalog(catalogName);
        if (cat == null) {
            System.out.println("Can't find entry for catalog: " + catalogName);
            System.exit(1);
        }

        try {
            QueryArgs q1 = new BasicQueryArgs(cat);
            q1.setId("GSC0285601186");
            QueryResult r1 = cat.query(q1);
            System.out.println("result: " + r1);

            System.out.println("");
            System.out.println("test query: at center position/radius: ");
            QueryArgs q2 = new BasicQueryArgs(cat);
            q2.setRegion(new CoordinateRadius(new WorldCoords("03:19:44.44", "+41:30:58.21"), 2.));
            QueryResult r2 = cat.query(q2);
            System.out.println("result: " + r2);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

            p = new FieldDescAdapter(NAME_SERVER);
            p.setDescription("Select the name server to use to resolve the object name");
            List<Catalog> l = AstroCatConfig.getConfigFile().getNameServers();
            NameValue[] ar = new NameValue[l.size()];
            for (int i = 0; i < ar.length; i++) {
                Catalog cat = l.get(i);
                ar[i] = new NameValue(cat.getName(), cat);
            }
            p.setOptions(ar);
            params.add(p);

            p = new FieldDescAdapter(RA);
View Full Code Here

     * Test cases
     */
    public static void main(String[] args) {
        String catalogName = "Guide Star Catalog at ESO";
        AstroCatConfig configFile = AstroCatConfig.getConfigFile();
        Catalog cat = configFile.getCatalog(catalogName);
        if (cat == null) {
            System.out.println("Can't find entry for catalog: " + catalogName);
            System.exit(1);
        }

        try {
            System.out.println("test query: at center position/radius: ");
            QueryArgs queryArgs = new BasicQueryArgs(cat);
            queryArgs.setParamValue("center", "03:19:44.44+41:30:58.21");
            queryArgs.setParamValue("radius", "2");
            QueryResult queryResult = cat.query(queryArgs);
            System.out.println("result: " + queryResult);
            if (queryResult instanceof AstroCatTable) {
                ((AstroCatTable) queryResult).saveAsSkycatTable(System.out);
            } else {
                System.out.println("Can't print table");
View Full Code Here

     * @param url The URL of the catalog, table or FITS file, if known, otherwise null
     * @param queryComponent The component displaying the catalog or query results (used in this session).
     */
    public CatalogHistoryItem(String name, URL url, JComponent queryComponent) {
        _name = name;
        Catalog catalog = CatalogFactory.getCatalogByName(name);
        if (catalog != null) {
            _type = catalog.getType();
        }
        if (url != null) {
            _urlStr = url.toString();
        }
        _queryComponent = queryComponent;
View Full Code Here

                p = new FieldDescAdapter(NAME_SERVER);
                p.setDescription("Select the name server to use to resolve the object name");
                List<Catalog> l = _configFile.getNameServers();
                NameValue[] ar = new NameValue[l.size()];
                for (int i = 0; i < ar.length; i++) {
                    Catalog cat = l.get(i);
                    ar[i] = new NameValue(cat.getName(), cat);
                }
                p.setOptions(ar);
                params.add(p);

                p = new FieldDescAdapter(RA);
View Full Code Here

    // If the abbreviated catalog description contains plot symbol descriptions,
    // they are copied to the original catalog object as well.
    public void _catalogsEnd() {
        int n = _catalogs.size();
        for (int i = n - 1; i >= 0; i--) {
            Catalog c = _catalogs.get(i);
            if (c instanceof AstroCatalog) {
                AstroCatalog catalog = (AstroCatalog) c;
                String path = catalog.getURLPath();
                if (path == null || path.length() == 0) {
                    Catalog cat = CatalogFactory.getCatalogByName(catalog.getName());
                    if (cat == null) {
                        _catalogs.remove(i); // remove dead links
                        LOG.warning("Catalog not found in any config files: '" + catalog.getName()
                                + "', referenced in " + getURL());
                    } else if (_catalogs.contains(cat)) {
View Full Code Here

        _addAttr(attrs, "version", VERSION);
        xml.startElement(NAMESPACE, LOCAL_NAME, "catalogs", attrs);

        Iterator it = catalogs.listIterator();
        while (it.hasNext()) {
            Catalog catalog = (Catalog) it.next();
            _saveCatalog(xml, catalog);
        }

        xml.endElement(NAMESPACE, LOCAL_NAME, "catalogs");
    }
View Full Code Here

            addToHistory();
            _queryPanel.remove(_queryComponent);
            _queryComponent = null;
        }
        _queryComponent = component;
        Catalog cat = _catalogTree.getSelectedCatalog();
        if (cat != null) {
            _panelTreeNodeTable.put(_queryComponent, cat);
        }
        _queryPanel.add(_queryComponent, BorderLayout.CENTER);
View Full Code Here

        // catalog may contain multiple tables and implement the CatalogDirectory interface
        if (catalog instanceof CatalogDirectory) {
            CatalogDirectory catalogDirectory = (CatalogDirectory) catalog;
            int numCatalogs = catalogDirectory.getNumCatalogs();
            if (numCatalogs == 1) {
                Catalog c = catalogDirectory.getCatalog(0);
                if (c instanceof TableQueryResult) {
                    return makeTableQueryResultComponent((TableQueryResult) c);
                } else {
                    DialogUtil.error(_I18N.getString("subCatalogError") + ": " + c);
                    return new EmptyPanel();
View Full Code Here

TOP

Related Classes of jsky.catalog.Catalog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.