Class NFENetworkRenderer

    • Constructor Detail

      • NFENetworkRenderer

        public NFENetworkRenderer​(MapCanvas canvas,
                                  NFEModel model)
        Allocates a new network renderer
        Parameters:
        canvas - the MapCanvas where the layer will be rendered
        model - the model containing the network to be rendered
    • Method Detail

      • synchronizeWithModel

        public void synchronizeWithModel()
        Refreshes the current state to refresh the state of the model's network
      • isShowFlow

        public boolean isShowFlow()
        Tells whether flow indicators are displayed for links
        Returns:
        true if flow is shown
      • setShowFlow

        public void setShowFlow​(boolean showFlow)
        Sets whether flow indicators are displayed for links
        Parameters:
        showFlow - true if flow should be shown
      • getFeatureLayerRenderers

        public java.util.List<NFEFeatureLayerRenderer> getFeatureLayerRenderers()
        Gets all the feature layer renderers associated
        Returns:
        a list of feature layer renderers
      • addFeatureLayerRenderer

        public void addFeatureLayerRenderer​(NFEFeatureLayerRenderer flRenderer)
        Associates a feature layer renderer
        Parameters:
        flRenderer - a feature layer renderer
      • removeFeatureLayerRenderer

        public boolean removeFeatureLayerRenderer​(NFEFeatureLayerRenderer flRenderer)
        Removes the association to a feature layer renderer
        Parameters:
        flRenderer - a feature layer renderer
        Returns:
        true if the association was removed
      • isHidden

        public boolean isHidden()
        Tells whether the layer is hidden
        Returns:
        true if it is hidden
      • setHidden

        public void setHidden​(boolean hidden)
        Sets whether the layer is hidden or not
        Parameters:
        hidden - true if it should be hidden
      • mapRegionChanged

        public void mapRegionChanged​(MapRegionEvent e)
        Description copied from interface: Layer
        When the associated canvas's map region is changed, this method is called to notify the layer of the change. Note that either a device window change (as a result of resizing the application window) or a data window change can cause this method to be invoked. Query the canvas' MapRegion object to get the changed values. Inside a mapRegionChanged() implementation, the layer typically needs to update its data contents accordingly.
        Specified by:
        mapRegionChanged in interface Layer
        Overrides:
        mapRegionChanged in class NFERenderer<NFENetworkElementGeoObject>
      • render

        public long render​(java.awt.Graphics2D graphics)
        Description copied from interface: Layer
        Renders the layer contents to the given Graphics.
        Specified by:
        render in interface Layer
        Overrides:
        render in class NFERenderer<NFENetworkElementGeoObject>
        Parameters:
        graphics - the graphics object
        Returns:
        the rendering time in milliseconds.
      • getGeoObjects

        protected java.util.Collection<NFENetworkElementGeoObject> getGeoObjects​(java.awt.geom.Point2D point,
                                                                                 int granularity)
        Description copied from class: NFERenderer
        Gets all the GeoObjects interacting with the given point
        Specified by:
        getGeoObjects in class NFERenderer<NFENetworkElementGeoObject>
        Parameters:
        point - a spatial point in screen coordinate system
        Returns:
        a collection containing all the GeoObjects interacting with the point
      • getGeoObjects

        protected java.util.Collection<NFENetworkElementGeoObject> getGeoObjects​(java.awt.geom.Rectangle2D rect)
        Description copied from class: NFERenderer
        Gets all the GeoObjects interacting with the given rectangle
        Specified by:
        getGeoObjects in class NFERenderer<NFENetworkElementGeoObject>
        Parameters:
        rect - a rectangle in screen coordinate system
        Returns:
        a collection containing all the GeoObjects interacting with the rectangle
      • belongsToTier

        protected boolean belongsToTier​(NFENetworkElementGeoObject geoObj,
                                        java.lang.String tierName)
        Description copied from class: NFERenderer
        Tells whether the GeoObject is rendered by the given tier
        Specified by:
        belongsToTier in class NFERenderer<NFENetworkElementGeoObject>
        Parameters:
        geoObj - a layer's GeoObject
        tierName - a tier name
        Returns:
        true if the GeoObject is rendered by (belongs to) the given tier
      • modelObjectsAdded

        public void modelObjectsAdded​(NFEModelObjectsEvent event)
        Description copied from interface: NFEModelListener
        Invoked when one or more model objects have been added
        Specified by:
        modelObjectsAdded in interface NFEModelListener
        Parameters:
        event - contains a collection of references to the model objects that have been added
      • modelObjectsRemoved

        public void modelObjectsRemoved​(NFEModelObjectsEvent event)
        Description copied from interface: NFEModelListener
        Invoked when one or more model objects have been removed
        Specified by:
        modelObjectsRemoved in interface NFEModelListener
        Parameters:
        event - contains a collection of references to the model objects that have been removed
      • getHandlePoints

        public double[] getHandlePoints​(GeoObject geoObj)
        Description copied from interface: ManipulableLayer
        Gets the ordinates of the points from which a GeoObject can be manipulated
        Specified by:
        getHandlePoints in interface ManipulableLayer
        Parameters:
        geoObj - a GeoObject
        Returns:
        an array of ordinates in model's coordinate system
      • getSnapPoint

        public oracle.sdovis.edit.util.JGeometrySegmentPoint getSnapPoint​(GeoObject geoObj,
                                                                          java.awt.geom.Point2D dataPoint,
                                                                          double tolerance)
        Description copied from interface: ManipulableLayer
        Gets the closer GeoObject's snap point to the given point using the tolerance specified
        Specified by:
        getSnapPoint in interface ManipulableLayer
        Specified by:
        getSnapPoint in interface VertexEditableLayer
        Parameters:
        geoObj - a GeoObject
        dataPoint - a point in model's coordinate system
        tolerance - a tolarence in model's coordinate system
        Returns:
        a segment point relative to the GeoObject's geometry
      • getApplicableTransformation

        public int getApplicableTransformation​(GeoObject geoObj,
                                               java.util.Collection<GeoObject> manGeoObjGroup,
                                               oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint)
        Description copied from interface: ManipulableLayer
        Gets manipulation available for the given GeoObject and its current snap point. It is also specified all the GeoObjects that need to be manipulated along with the first GeoObject passed.
        Specified by:
        getApplicableTransformation in interface ManipulableLayer
        Parameters:
        geoObj - a GeoObject
        manGeoObjGroup - a collection containing more GeoObjects to be manipulated. It can be null
        snapPoint - a segment point relative to the GeoObject's geometry
        Returns:
        a manipulation code
      • startManipulation

        public long startManipulation​(GeoObject geoObj,
                                      java.util.Collection<GeoObject> manGeoObjGroup,
                                      oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint,
                                      int transformation)
        Description copied from interface: ManipulableLayer
        Starts a manipulation session. The manipulation will be performed over the give GeoObject and the GeoObject group passed.
        Specified by:
        startManipulation in interface ManipulableLayer
        Parameters:
        geoObj - the target GeoObject to be manipulated
        manGeoObjGroup - a group of GeoObjects to be manipulated
        snapPoint - a segment point relative to the GeoObject's geometry
        transformation - the type of manipulation to be performed
        Returns:
        a manipulation session id
      • finishManipulation

        public boolean finishManipulation​(long manId,
                                          java.awt.geom.Point2D dataPoint)
        Description copied from interface: ManipulableLayer
        finishes the manipulation identified by the given id. The last mouse point is specified.
        Specified by:
        finishManipulation in interface ManipulableLayer
        Parameters:
        manId - the manipulation session id
        dataPoint - the last point for the manipulation in model's coordinate system
        Returns:
        true if the manipulation was performed successfully
      • manipulate

        public boolean manipulate​(long manId,
                                  java.awt.geom.Point2D dataPoint)
        Description copied from interface: ManipulableLayer
        Updates the state of a manipulation with the last point. It is useful if a live preview has to be shown.
        Specified by:
        manipulate in interface ManipulableLayer
        Parameters:
        manId - a manipulation session id
        dataPoint - the last user point (it may be a mouse point) in model's coordinate system
        Returns:
        true if the manipulation state was updated successfully
      • cancelManipulation

        public void cancelManipulation​(long manId)
        Description copied from interface: ManipulableLayer
        Cancels the given manipulation and releases all the resources related to it
        Specified by:
        cancelManipulation in interface ManipulableLayer
        Parameters:
        manId - a manipulation session id
      • getVertices

        public double[] getVertices​(GeoObject geoObj)
        Description copied from interface: VertexEditableLayer
        Gets all the vertices of the GeoObject
        Specified by:
        getVertices in interface VertexEditableLayer
        Parameters:
        geoObj - a GeoObject
        Returns:
        an array containing the ordinates of the GeoObject's vertices
      • canAddVertex

        public boolean canAddVertex​(GeoObject geoObj,
                                    oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint)
        Description copied from interface: VertexEditableLayer
        Tells whether it is possible to add a new vertex to the GeoObject at the specified snap point
        Specified by:
        canAddVertex in interface VertexEditableLayer
        Parameters:
        geoObj - a GeoObject
        snapPoint - a segment point relative to the GeoObject's geometry
        Returns:
        true if it is possible to add a new vertex
      • addVertex

        public boolean addVertex​(GeoObject geoObj,
                                 oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint)
        Description copied from interface: VertexEditableLayer
        Adds a vertex to the given GeoObject at the specified snap point
        Specified by:
        addVertex in interface VertexEditableLayer
        Parameters:
        geoObj - a GeoObject
        snapPoint - a segment point relative to the GeoObject's geometry
        Returns:
        true if the vertex was successfully added