Examples of EsriGraphicList


Examples of com.bbn.openmap.dataAccess.shape.EsriGraphicList

                    int returnVal = fileChooser.showSaveDialog(null);
                    if (returnVal == JFileChooser.APPROVE_OPTION) {
                        try {
                            File file = fileChooser.getSelectedFile();
                            String path = file.getCanonicalPath();
                            EsriGraphicList list = layer.getEsriGraphicList();

                            ShpOutputStream pos = new ShpOutputStream(new FileOutputStream(path
                                    + ".shp"));
                            int[][] indexData = pos.writeGeometry(list);

                            ShxOutputStream xos = new ShxOutputStream(new FileOutputStream(path
                                    + ".shx"));
                            xos.writeIndex(indexData,
                                    list.getType(),
                                    list.getExtents());

                            DbfOutputStream dos = new DbfOutputStream(new FileOutputStream(path
                                    + ".dbf"));
                            dos.writeModel(layer.getModel());
                        } catch (Exception exception) {
View Full Code Here

Examples of com.bbn.openmap.dataAccess.shape.EsriGraphicList

                ListSelectionModel lsm2 = (ListSelectionModel) e.getSource();
                if (lsm2.isSelectionEmpty()) {
                    //no rows are selected
                } else {
                    int index = lsm2.getMinSelectionIndex();
                    EsriGraphicList list = layer.getEsriGraphicList();
                    OMGraphic graphic = list.getOMGraphicAt(index);
                    graphic.select();
                    list.generate(_mapBean.getProjection());
                    layer.repaint();
                }
            }
        });
        frame.setSize(400, 300);
View Full Code Here

Examples of com.bbn.openmap.dataAccess.shape.EsriGraphicList

     * Mark a graphic as selected on the map.
     *
     * @param index the index, from 0, of the graphic on the list.
     */
    public void selectGraphic(int index) {
        EsriGraphicList list = getEsriGraphicList();
        list.deselectAll();
        // Clear out the selected graphics list
        selectedGraphics.clear();
        selectGraphic(list.getOMGraphicAt(index));
        graphicIndex = index;
        list.regenerate(proj);
    }
View Full Code Here

Examples of com.bbn.openmap.dataAccess.shape.EsriGraphicList

    /**
     * Handle a mouse click on the map.
     */
    public boolean mouseClicked(MouseEvent e) {
        EsriGraphicList list = getEsriGraphicList();
        boolean ret = false;
        graphicIndex = -1;

        if (list != null) {
            OMGraphic omg = list.selectClosest(e.getX(), e.getY(), 4);
            if (omg != null) {
                // graphicIndex has to be set before selectEntry
                // called.
                graphicIndex = list.indexOf(omg);
                selectEntry(omg);

                ret = true;
            } else {
                if (lsm == null)
                    getTable();
                lsm.clearSelection();
                list.deselect();
                selectedGraphics.clear();
                repaint();
            }
        }
        return ret;
View Full Code Here

Examples of com.bbn.openmap.dataAccess.shape.EsriGraphicList

    /**
     * Handle mouse moved events (Used for firing tool tip descriptions over
     * graphics)
     */
    public boolean mouseMoved(MouseEvent e) {
        EsriGraphicList list = getEsriGraphicList();
        boolean ret = false;
        if (list != null) {
            OMGraphic omg = list.findClosest(e.getX(), e.getY(), 4);
            if (omg != null) {
                int index;

                Integer I = ((Integer) omg.getAttribute(SHAPE_INDEX_ATTRIBUTE));
                if (I != null) {
                    index = I.intValue() - 1;
                } else {
                    index = list.indexOf(omg);
                }

                if (parentLayer == null) {
                    Component comp = getComponent();
                    if (comp != null && comp instanceof Layer) {
View Full Code Here

Examples of com.bbn.openmap.dataAccess.shape.EsriGraphicList

            if (graphic instanceof EsriGraphicList) {

                // Assumes that the elements of the top level list are
                // EsriGraphicLists, too. This will probably be
                // changing.
                EsriGraphicList sublist = (EsriGraphicList) graphic;

                // Writes bounding box.
                extents = sublist.getExtents();
                writeExtents(extents);

                // Writes number of parts
                int numParts = sublist.size();
                _leos.writeLEInt(numParts);

                // Write number of points per shape
                int numPoints = getPointsPerShape(sublist);
                _leos.writeLEInt(numPoints);

                // Write the offsets to each part for a given shape
                int[] offsets = getPartOffsets(sublist);

                for (int j = 0; j < offsets.length; j++) {
                    _leos.writeLEInt(offsets[j]);
                }

                // Write the geometry for each part
                for (int j = 0; j < sublist.size(); j++) {
                    poly = (OMPoly) sublist.getOMGraphicAt(j);
                    float[] data = poly.getLatLonArray();
                    int n = 0;
                    while (n < data.length) {
                        Float lat = new Float(data[n++]);
                        Float lon = new Float(data[n++]);
View Full Code Here

Examples of com.bbn.openmap.dataAccess.shape.EsriGraphicList

     *         created by iterating through this input stream *
     * @deprecated not used.
     */
    public EsriGraphicList getPointGeometry(int[][] indexData) throws Exception {

        EsriGraphicList list = new EsriPointList();
        int numShapes = indexData[1].length;

        EsriPoint point;
        for (int i = 0; i < numShapes; i++) {
            int shpRecord = _leis.readInt();
            /* int shpContentLength = */_leis.readInt();
            int shpType = _leis.readLEInt();
            if (shpType != SHAPE_TYPE_NULL) {

                double lambda = _leis.readLEDouble();
                double phi = _leis.readLEDouble();

                float f1 = (float) lambda;
                float f2 = (float) phi;

                point = new EsriPoint(f2, f1);
                point.putAttribute(SHAPE_INDEX_ATTRIBUTE,
                        new Integer(shpRecord));
                if (drawingAttributes != null) {
                    drawingAttributes.setTo(point);
                } else {
                    DrawingAttributes.DEFAULT.setTo(point);
                }
                list.add(point);
            }
        }
        return list;
    }
View Full Code Here

Examples of com.bbn.openmap.dataAccess.shape.EsriGraphicList

     * @deprecated not used.
     */
    public EsriGraphicList getPolyGeometry(int[][] indexData, int shapeType)
            throws Exception {

        EsriGraphicList list = null;
        if (shapeType == SHAPE_TYPE_POLYLINE) {
            list = new EsriPolylineList();
        } else if (shapeType == SHAPE_TYPE_POLYGON) {
            list = new EsriPolygonList();
        }

        int numVertices;

        int numShapes = indexData[1].length;

        for (int t = 0; t < numShapes; t++) {
            Integer shpRecordIndex = new Integer(_leis.readInt());
            /* int shpContentLength = */_leis.readInt();
            int shpType = _leis.readLEInt();

            if (shpType != SHAPE_TYPE_NULL) {

                /* double xLeft = */_leis.readLEDouble();
                /* double xBottom = */_leis.readLEDouble();
                /* double xRight = */_leis.readLEDouble();
                /* double xTop = */_leis.readLEDouble();
                int numParts = _leis.readLEInt();
                int numPoints = _leis.readLEInt();

                int[] offsets = new int[numParts];

                // OK, we don't want to create a sublist unless the poly
                // has multiple parts. Remember that. sublist will only
                // be created if there is more than one part.

                for (int n = 0; n < numParts; n++) {
                    offsets[n] = _leis.readLEInt();
                }

                float[] points;
                OMGraphic poly = null;
                EsriGraphicList sublist = null;

                if (numParts > 1) {
                    if (shapeType == SHAPE_TYPE_POLYLINE) {
                        sublist = new EsriPolylineList();
                    } else if (shapeType == SHAPE_TYPE_POLYGON) {
                        sublist = new EsriPolygonList();
                    }

                    sublist.setVague(true); // Treat sublist as one
                    // OMGraphic.
                    sublist.putAttribute(SHAPE_INDEX_ATTRIBUTE,
                            shpRecordIndex);
                }

                for (int j = 0; j < numParts; j++) {
                    int i = 0;
                    if (j != numParts - 1) {
                        numVertices = (offsets[j + 1]) - offsets[j];
                        points = new float[numVertices * 2];
                    } else {
                        numVertices = (numPoints - offsets[j]);
                        points = new float[numVertices * 2];
                    }
                    for (int n = 0; n < numVertices; n++) {
                        double lambda = _leis.readLEDouble();
                        double phi = _leis.readLEDouble();

                        points[i++] = (float) Math.toRadians(phi);
                        points[i++] = (float) Math.toRadians(lambda);
                    }

                    if (shapeType == SHAPE_TYPE_POLYLINE) {
                        poly = new EsriPolyline(points, OMGraphic.RADIANS, OMGraphic.LINETYPE_GREATCIRCLE);
                    } else if (shapeType == SHAPE_TYPE_POLYGON) {
                        poly = new EsriPolygon(points, OMGraphic.RADIANS, OMGraphic.LINETYPE_GREATCIRCLE);
                    }

                    if (drawingAttributes != null) {
                        drawingAttributes.setTo(poly);
                    } else {
                        DrawingAttributes.DEFAULT.setTo(poly);
                    }

                    if (poly instanceof EsriPolyline) {
                        // Just to make sure it gets rendered as a
                        // polyline. The OMPoly code will render it as a
                        // polygon if the fill color is not clear.
                        poly.setFillPaint(OMColor.clear);
                    }

                    // sublist is null for non multi-part geometries.
                    if (sublist != null) {
                        sublist.addOMGraphic(poly);
                    } else {
                        poly.putAttribute(SHAPE_INDEX_ATTRIBUTE,
                                shpRecordIndex);
                    }
                }
View Full Code Here

Examples of com.bbn.openmap.dataAccess.shape.EsriGraphicList

                String shpFileName = shpFile.getName();

                DrawingAttributes da = new DrawingAttributes();
                da.setSelectPaint(new Color(200, 100, 100, 200));

                EsriGraphicList shapeList = EsriGraphicList.getEsriGraphicList(shpFile.toURL(),
                        da,
                        DbfTableModel.getDbfTableModel(new File(shpFilePath.replaceAll(".shp",
                                ".dbf")).toURL()));

                if (DEBUG)
                    Debug.output("GeoIntersectLayer(" + getName()
                            + "): Adding shapes from " + shpFileName);

                JCheckBox visibilityControl = new JCheckBox("Show", true);
                visibilityControl.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent ae) {
                        setShapeListVisibilityForCheckbox();
                        repaint();
                    }
                });

                JButton removeButton = new JButton("Remove");
                removeButton.addActionListener(new RemoveShapesActionListener(fileDataList, shapeList));

                JLabel label = new JLabel(shpFileName, JLabel.LEFT);
                JPanel panel = new JPanel();
                GridBagLayout gridbag = new GridBagLayout();
                panel.setLayout(gridbag);
                GridBagConstraints c = new GridBagConstraints();
                c.weightx = 1.0;
                c.insets = new Insets(2, 2, 2, 2);
                c.anchor = GridBagConstraints.WEST;
                c.fill = GridBagConstraints.HORIZONTAL;
                gridbag.setConstraints(label, c);
                panel.add(label);
                c.weightx = 0;
                c.anchor = GridBagConstraints.EAST;
                c.fill = GridBagConstraints.NONE;
                gridbag.setConstraints(visibilityControl, c);
                panel.add(visibilityControl);
                gridbag.setConstraints(removeButton, c);
                panel.add(removeButton);

                shapeList.putAttribute(SHAPE_FILE_NAME_ATTRIBUTE, shpFileName);
                shapeList.putAttribute(SHAPE_VISIBILITY_CONTROL_ATTRIBUTE,
                        visibilityControl);
                shapeList.putAttribute(SHAPE_CONTROL_ATTRIBUTE, panel);

                int type = shapeList.getType();
                if (type != EsriGraphicList.SHAPE_TYPE_POLYGON
                        && type != EsriGraphicList.SHAPE_TYPE_POLYLINE) {
                    fireRequestMessage("The type of shapes contained in the file\n"
                            + shpFileName
                            + "\nisn't handled by this layer.  Choose a file that\ncontains lines or polygons.");
View Full Code Here

Examples of com.bbn.openmap.dataAccess.shape.EsriGraphicList

        getRegionIndex(false).clear();
        for (Iterator it = fileDataList.iterator(); it.hasNext();) {
            Object obj = it.next();
            if (obj instanceof EsriGraphicList) {
                EsriGraphicList shapeList = (EsriGraphicList) obj;
                JPanel control = (JPanel) shapeList.getAttribute(SHAPE_CONTROL_ATTRIBUTE);
                if (control != null) {
                    control.setBackground(current);
                    Component[] comps = control.getComponents();
                    for (int i = 0; i < comps.length; i++) {
                        comps[i].setBackground(current);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.