Class VectorLayer



  • public class VectorLayer
    extends MapLayer
    Vector layer class
    • Constructor Detail

      • VectorLayer

        public VectorLayer​(ShapeTypes shapeType)
        Constructor
        Parameters:
        shapeType - Shape type
    • Method Detail

      • getUndoManager

        public javax.swing.undo.UndoManager getUndoManager​()
        Get UndoManager
        Returns:
        UndoManager
      • getAvoidCollision

        public boolean getAvoidCollision​()
        Get if avoid collision
        Returns:
        Boolean
      • setAvoidCollision

        public void setAvoidCollision​(boolean istrue)
        Set if avoid collision
        Parameters:
        istrue - Boolean
      • getShapeNum

        public int getShapeNum​()
        Get shape number
        Returns:
        Shape number
      • getShapes

        public java.util.List<? extends Shape> getShapes​()
        Get shape list
        Returns:
        Shape list
      • setShapes

        public void setShapes​(java.util.List<? extends Shape> shapes)
        Set shape list
        Parameters:
        shapes - Shape list
      • getAttributeTable

        public AttributeTable getAttributeTable​()
        Get attribute table
        Returns:
        The attribute table
      • setAttributeTable

        public void setAttributeTable​(AttributeTable table)
        Set attribute table
        Parameters:
        table - The attribute table
      • getIdentiferShape

        public int getIdentiferShape​()
        Get identifer shape index
        Returns:
        The identifer shape index
      • setIdentiferShape

        public void setIdentiferShape​(int idx)
        Set identifer shape index
        Parameters:
        idx - Identifer shape index
      • setTransparency

        public void setTransparency​(int trans)
        Description copied from class: MapLayer
        Set transparency percent
        Overrides:
        setTransparency in class MapLayer
        Parameters:
        trans - Transparency percent
      • getLabelSet

        public LabelSet getLabelSet​()
        Get label set
        Returns:
        Label set
      • setLabelSet

        public void setLabelSet​(LabelSet ls)
        Set label set
        Parameters:
        ls - Label set
      • getLabelPoints

        public java.util.List<Graphic> getLabelPoints​()
        Get label points
        Returns:
        The lable points
      • setLabelPoints

        public void setLabelPoints​(java.util.List<Graphic> lps)
        Set label points
        Parameters:
        lps - The lable points
      • getChartSet

        public ChartSet getChartSet​()
        Get chart set
        Returns:
        Chart set
      • setChartSet

        public void setChartSet​(ChartSet cs)
        Set chart set
        Parameters:
        cs - Chart set
      • getChartPoints

        public java.util.List<ChartGraphic> getChartPoints​()
        Get chart points
        Returns:
        The chart points
      • setChartPoints

        public void setChartPoints​(java.util.List<ChartGraphic> cps)
        Set chart pints
        Parameters:
        cps - The chart points
      • getDrawingZoom

        public float getDrawingZoom​()
        Get drawing zoom
        Returns:
        Drawing zoom
      • setDrawingZoom

        public void setDrawingZoom​(float zoom)
        Set drawing zoom
        Parameters:
        zoom - Drawing zoom
      • isProjected

        public boolean isProjected​()
        Get if is projected
        Returns:
        Boolean
      • setProjected

        public void setProjected​(boolean istrue)
        Set if is projected
        Parameters:
        istrue - Boolean
      • setLegendScheme

        public void setLegendScheme​(LegendScheme value)
        Override set legend scheme
        Overrides:
        setLegendScheme in class MapLayer
        Parameters:
        value - Legend scheme
      • isEditing

        public boolean isEditing​()
        Get if is editing
        Returns:
        Boolean
      • setEditing

        public void setEditing​(boolean value)
        Set if is editing
        Parameters:
        value - Boolean
      • getEditingShape

        public Shape getEditingShape​()
        Get editing shape
        Returns:
        Editing shape
      • setEditingShape

        public void setEditingShape​(Shape value)
        Set editing shape
        Parameters:
        value - The shape
      • updateChartsProp

        public void updateChartsProp​()
        Update charts properties
      • addCharts

        public void addCharts​()
        Add charts
      • updateChartSet

        public void updateChartSet​()
        Update chart set with minimum and maximum values
      • updateCharts

        public void updateCharts​()
        Update charts
      • addChart

        public void addChart​(ChartGraphic aCP)
        Add a chart point
        Parameters:
        aCP - Chart point
      • removeCharts

        public void removeCharts​()
        Remove all charts
      • getShape

        public Shape getShape​(int idx)
        Get a shape by index
        Parameters:
        idx - Shape index
        Returns:
        Shape
      • addShape

        public void addShape​(Shape aShape)
        Add a shape
        Parameters:
        aShape - Shape
      • findShape_contains

        public Shape findShape_contains​(Shape other)
        Find a shape contains anthor shape
        Parameters:
        other - Another shape
        Returns:
        Result shape
      • findShape_crosses

        public Shape findShape_crosses​(Shape other)
        Find a shape crosses anthor shape
        Parameters:
        other - Another shape
        Returns:
        Result shape
      • findReformShape

        public Shape findReformShape​(PolylineShape other)
        Find a shape for reformation by a polyline shape
        Parameters:
        other - The polyline shape
        Returns:
        Result shape
      • selectShapes

        public java.util.List<java.lang.Integer> selectShapes​(Extent extent)
        Select shapes
        Parameters:
        extent - The extent
        Returns:
        Selected shapes
      • selectShapes

        public java.util.List<java.lang.Integer> selectShapes​(Extent aExtent,
                                                              boolean isSingleSel)
        Select shapes
        Parameters:
        aExtent - The extent
        isSingleSel - If just select one shape
        Returns:
        Selected shapes
      • selectShapes

        public java.util.List<java.lang.Integer> selectShapes​(Extent aExtent,
                                                              java.util.List<Shape> shapes,
                                                              boolean isSingleSel)
        Select shapes
        Parameters:
        aExtent - The extent
        shapes - The shape list to be selected
        isSingleSel - If just select one shape
        Returns:
        Selected shapes
      • selectShapes

        public java.util.List<java.lang.Integer> selectShapes​(PolygonShape polygonShape)
        Select shapes by a polygon shape
        Parameters:
        polygonShape - The polygon shape
        Returns:
        Selected shape indexes
      • sqlSelect

        public void sqlSelect​(java.lang.String expression)
        Select shapes by SQL expression
        Parameters:
        expression - The SQL expression
      • sqlSelect

        public void sqlSelect​(java.lang.String expression,
                              java.lang.String selType)
        Select shapes by SQL expression
        Parameters:
        expression - The SQL expression
        selType - Selection type
      • sqlSelect

        public void sqlSelect​(java.lang.String expression,
                              org.meteoinfo.layer.VectorLayer.SelectType selType)
        Select shapes by SQL expression
        Parameters:
        expression - The SQL expression
        selType - Selection type
      • selectShape

        public Shape selectShape​(PointD p)
        Select a shape by point
        Parameters:
        p - The point
        Returns:
        Selected shape
      • selectPolygonHole

        public java.lang.Object[] selectPolygonHole​(PointD p)
        Get polygon hole index by point
        Parameters:
        p - The point
        Returns:
        PolygonShape and polygon hole index
      • getSelectedDataRows

        public java.util.List<DataRow> getSelectedDataRows​()
        Get seleted data rows
        Returns:
        Selected data rows
      • getSelectedShapes

        public java.util.List<? extends Shape> getSelectedShapes​()
        Get selected shapes
        Returns:
        Selected shapes
      • getSelectedShapeIndexes

        public java.util.List<java.lang.Integer> getSelectedShapeIndexes​()
        Get selected shape index list
        Returns:
        Index list
      • getVisibleShapes

        public java.util.List<Shape> getVisibleShapes​()
        Get visible shapes
        Returns:
        The visible shapes
      • clearSelectedShapes

        public void clearSelectedShapes​()
        Clear selected shapes
      • hasSelectedShapes

        public boolean hasSelectedShapes​()
        Get if has selected shape
        Returns:
        Boolean
      • clearEditingShape

        public void clearEditingShape​()
        Clear editing shape
      • getFieldNumber

        public int getFieldNumber​()
        Get field number
        Returns:
        Field number
      • getFieldName

        public java.lang.String getFieldName​(int FieldIndex)
        Get field name by index
        Parameters:
        FieldIndex - Field index
        Returns:
        Field name
      • getFieldNames

        public java.util.List<java.lang.String> getFieldNames​()
        Get field name list
        Returns:
        The field name list
      • getFields

        public java.util.List<Field> getFields​()
        Get fields
        Returns:
        Fields
      • getField

        public Field getField​(int idx)
        Get field by index
        Parameters:
        idx - The field index
        Returns:
        The field
      • getField

        public Field getField​(java.lang.String fieldName)
        Get field by field name
        Parameters:
        fieldName - Field name
        Returns:
        The field
      • getFieldIdxByName

        public int getFieldIdxByName​(java.lang.String fieldName)
        Get field index by name
        Parameters:
        fieldName - The field name
        Returns:
        Field index
      • getCellValue

        public java.lang.Object getCellValue​(int fieldIndex,
                                             int shapeIndex)
        Get cell value
        Parameters:
        fieldIndex - Field index
        shapeIndex - Shape index
        Returns:
        Cell value
      • getCellValue

        public java.lang.Object getCellValue​(java.lang.String fieldName,
                                             int shapeIndex)
        Get cell value
        Parameters:
        fieldName - Field name
        shapeIndex - Shape index
        Returns:
        Cell value
      • getDataRows

        public java.util.List<DataRow> getDataRows​()
        Get all data rows
        Returns:
        All data rows
      • editAddField

        public void editAddField​(Field aField)
        Edit: Add a field
        Parameters:
        aField - The field
      • editAddField

        public void editAddField​(java.lang.String fieldName,
                                 DataTypes fieldType)
        Edit: Add a field
        Parameters:
        fieldName - Field name
        fieldType - Field data type
      • editRemoveField

        public void editRemoveField​(java.lang.String fieldName)
        Edit: Remove a field
        Parameters:
        fieldName - Field name
      • editRenameField

        public void editRenameField​(java.lang.String fieldName,
                                    java.lang.String newFieldName)
        Edit: Rename a field
        Parameters:
        fieldName - Origin field name
        newFieldName - New field name
      • editCellValue

        public void editCellValue​(java.lang.String fieldName,
                                  int shapeIndex,
                                  java.lang.Object value)
        Edit: Edit cell value
        Parameters:
        fieldName - Field name
        shapeIndex - Shape index
        value - The data value
      • editCellValue

        public void editCellValue​(int fieldIndex,
                                  int shapeIndex,
                                  java.lang.Object value)
        Edit: Edit cell value
        Parameters:
        fieldIndex - Field index
        shapeIndex - Shape index
        value - Data value
      • getMinValue

        public double getMinValue​(java.lang.String fieldName)
        Get minimum data value of a field
        Parameters:
        fieldName - Field name
        Returns:
        Minimum data
      • joinTable

        public void joinTable​(DataTable dataTable,
                              java.lang.String colName)
        Join data table
        Parameters:
        dataTable - The input data table
        colName - The column name for join
      • joinTable

        public void joinTable​(DataTable dataTable,
                              java.lang.String colName,
                              boolean isUpdate)
        Join data table
        Parameters:
        dataTable - The input data table
        colName - The column name for join
        isUpdate -
      • joinTable

        public void joinTable​(DataTable dataTable,
                              java.lang.String colName_this,
                              java.lang.String colName_in,
                              boolean isUpdate)
        Join data table
        Parameters:
        dataTable - The input data table
        colName_this - The column name of this data table for join
        colName_in - The column name of the input data table for join
        isUpdate - If update the existing values with same column name
      • removeJoins

        public void removeJoins​()
        Remove joined data columns
      • editInsertShape

        public boolean editInsertShape​(Shape aShape,
                                       int position)
                                throws java.lang.Exception
        Edit: Insert shape
        Parameters:
        aShape - The shape
        position - The position index
        Returns:
        If success
        Throws:
        java.lang.Exception
      • editInsertShape

        public boolean editInsertShape​(Shape aShape,
                                       int position,
                                       DataRow record)
                                throws java.lang.Exception
        Edit: Insert shape
        Parameters:
        aShape - The shape
        position - The position index
        record -
        Returns:
        If success
        Throws:
        java.lang.Exception
      • editAddShape

        public boolean editAddShape​(Shape aShape)
                             throws java.lang.Exception
        Edit: Add a shape
        Parameters:
        aShape - The shape
        Returns:
        If success
        Throws:
        java.lang.Exception
      • editAddShape

        public void editAddShape​(Shape aShape,
                                 java.util.List<java.lang.Object> fvalues)
                          throws java.lang.Exception
        Edit: Add a shape
        Parameters:
        aShape - The shape
        fvalues - Field values
        Throws:
        java.lang.Exception
      • editRemoveShape

        public void editRemoveShape​(Shape shape)
        Edit: Remove a shape
        Parameters:
        shape - The shape
      • saveFile

        public void saveFile​()
        Save layer as a shape file
        Overrides:
        saveFile in class MapLayer
      • saveFile

        public void saveFile​(java.lang.String shpfilepath)
        Save layer as a shape file
        Overrides:
        saveFile in class MapLayer
        Parameters:
        shpfilepath - Shape file path
      • saveFile

        public void saveFile​(java.lang.String shpfilepath,
                             java.lang.String encoding)
        Save layer as a shape file
        Parameters:
        shpfilepath - Shape file path
        encoding - Encoding
      • buffer

        public VectorLayer buffer​(double distance,
                                  boolean onlySel,
                                  boolean isMerge)
        Buffer the shapes
        Parameters:
        distance - Distance
        onlySel - If only buffer selected shapes
        isMerge - If merge or not
        Returns:
        Bufferred layer
      • convexhull

        public VectorLayer convexhull​(boolean onlySel,
                                      boolean isMerge)
        Get convex hull of the shapes
        Parameters:
        onlySel - If only buffer selected shapes
        isMerge - If merge or not
        Returns:
        Result layer
      • clip

        public VectorLayer clip​(VectorLayer clipLayer)
        Clip the layer by a clipping layer
        Parameters:
        clipLayer - Clipping layer
        Returns:
        Clipped result layer
      • clip

        public VectorLayer clip​(VectorLayer clipLayer,
                                boolean onlySel)
        Clip the layer by a clipping layer
        Parameters:
        clipLayer - Clipping layer
        onlySel - If only using selected shapes in clipping layer
        Returns:
        Clipped result layer
      • clip

        public VectorLayer clip​(java.util.List<PolygonShape> clipPolys)
        Clip the layer by clipping polygons
        Parameters:
        clipPolys - Clipping polygons
        Returns:
        Clipped result layer
      • clip_bak

        public VectorLayer clip_bak​(java.util.List<PolygonShape> clipPolys)
        Clip the layer by clipping polygons
        Parameters:
        clipPolys - Clipping polygons
        Returns:
        Clipped result layer
      • intersection

        public VectorLayer intersection​(VectorLayer ilayer,
                                        boolean onlySel,
                                        boolean onlySelOther)
        Intersection the layer by another layer
        Parameters:
        ilayer - Intersection layer
        onlySel - Only selected shapes in this layer
        onlySelOther - Only selected shapes in
        Returns:
        Result layer
      • intersection

        public VectorLayer intersection​(java.util.List<PolygonShape> clipPolys,
                                        boolean onlySel)
        Intersection the layer by polygons
        Parameters:
        clipPolys - Intersection polygons
        onlySel - Only selected shapes
        Returns:
        Result layer
      • difference

        public VectorLayer difference​(java.util.List<PolygonShape> clipPolys,
                                      boolean onlySel)
        Difference the layer by polygons
        Parameters:
        clipPolys - Difference polygons
        onlySel - Only selected shapes
        Returns:
        Result layer
      • symDifference

        public VectorLayer symDifference​(java.util.List<PolygonShape> clipPolys,
                                         boolean onlySel)
        Symmetrical difference the layer by polygons
        Parameters:
        clipPolys - Symmetrical difference polygons
        onlySel - Only selected shapes
        Returns:
        Result layer
      • addLabel

        public void addLabel​(Graphic aLP)
        Add label point
        Parameters:
        aLP - Label point
      • getLabel

        public Graphic getLabel​(java.lang.String text)
        Get a label by text
        Parameters:
        text - Text
        Returns:
        Label
      • moveLabel

        public void moveLabel​(java.lang.String text,
                              float x,
                              float y)
        Move label
        Parameters:
        text - Label text
        x - X
        y - Y
      • moveLabel

        public void moveLabel​(Graphic lb,
                              float x,
                              float y)
        Move label
        Parameters:
        lb - Label
        x - X
        y - Y
      • removeLabels

        public void removeLabels​()
        Remove all labels
      • addLabels

        public void addLabels​()
        Add labels
      • addLabelsContourDynamic

        public void addLabelsContourDynamic​(Extent sExtent)
        Add labels of contour layer dynamicly
        Parameters:
        sExtent - View extent of MapView
      • updateOriginData

        public void updateOriginData​()
        Update data to origion set
      • getOriginData

        public void getOriginData​()
        Get origin data
      • saveAsKMLFile

        public void saveAsKMLFile​(java.lang.String fileName)
        Save as KML (Google Earth data format) file
        Parameters:
        fileName - KML file name
      • updateExtent

        public void updateExtent​()
        Update extent
      • updateLegendScheme

        public void updateLegendScheme​(LegendType aLT,
                                       java.lang.String fieldName)
        Update legend scheme
        Parameters:
        aLT - Legend type
        fieldName - Field name
      • updateLegendIndexes

        public void updateLegendIndexes​()
        Update legend scheme -> update legend indexes of the shapes
      • createLegendScheme

        public LegendScheme createLegendScheme​(LegendType aLT,
                                               java.lang.String fieldName)
        Create legend scheme
        Parameters:
        aLT - Legend type
        fieldName - Field name
        Returns:
        Legend scheme
      • clone

        public java.lang.Object clone​()
        Clone VectorLayer object
        Overrides:
        clone in class MapLayer
        Returns:
        VectorLayer object
      • cloneShapes

        public java.lang.Object cloneShapes​()
        Clone VectorLayer object - without attribute table
        Returns:
        Object
      • cloneValue

        public java.lang.Object cloneValue​()
        Clone VectorLayer object - only parameters
        Returns:
        Object
      • getLayerInfo

        public java.lang.String getLayerInfo​()
        To string
        Overrides:
        getLayerInfo in class MapLayer
        Returns:
        String