Examples of ILayer


Examples of org.eclipse.nebula.widgets.nattable.layer.ILayer

     * Check if any column belongs to a group. If yes, add all columns in that
     * group. Assumes that the 'toLocation' is not inside another group
     */
    @Override
    protected boolean doCommand(ReorderColumnsAndGroupsCommand command) {
        final ILayer underlyingLayer = columnGroupReorderLayer
                .getUnderlyingLayer();
        List<String> groupsProcessed = new ArrayList<String>();

        List<Integer> fromColumnPositions = command.getFromColumnPositions();
        List<Integer> fromColumnPositionsWithGroupColumns = new ArrayList<Integer>();

        for (Integer fromColumnPosition : fromColumnPositions) {
            int fromColumnIndex = underlyingLayer
                    .getColumnIndexByPosition(fromColumnPosition.intValue());

            ColumnGroupModel model = columnGroupReorderLayer.getModel();
            if (model.isPartOfAGroup(fromColumnIndex)) {
                String groupName = model.getColumnGroupByIndex(fromColumnIndex)
                        .getName();
                if (!groupsProcessed.contains(groupName)) {
                    groupsProcessed.add(groupName);
                    fromColumnPositionsWithGroupColumns
                            .addAll(columnGroupReorderLayer
                                    .getColumnGroupPositions(fromColumnIndex));
                }
            } else {
                fromColumnPositionsWithGroupColumns.add(fromColumnPosition);
            }
        }

        return underlyingLayer.doCommand(new MultiColumnReorderCommand(
                columnGroupReorderLayer, fromColumnPositionsWithGroupColumns,
                command.getToColumnPosition(), command.isReorderToLeftEdge()));
    }
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

//                .getBoolean(SelectionToolPreferencePage.ZOOM_TO_SELECTION);
        boolean isNavigate = SelectPlugin.getDefault().getPreferenceStore()
                .getBoolean(SelectionToolPreferencePage.NAVIGATE_SELECTION);
       
        AOILayerStrategy strategy = getAOILayerStrategy();
        ILayer activeLayer = strategy.getActiveLayer();
        ILayer previousLayer = strategy.getPreviousLayer();
        ILayer nextLayer = strategy.getNextLayer();
       
        ILayer selectedLayer = activeLayer;
       
        // change the layer we are looking at based on navigation
        Geometry geometry = strategy.getGeometry();
        Polygon testLocation = JTS.toGeometry(this.bbox);
        if(isNavigate && (mouseEvent.button == MapMouseEvent.BUTTON3)){
            if( previousLayer != null ){
                selectedLayer = previousLayer;
            }
            else {
                // end of the world!
                updateAOIService(null, null);
                bounds = getMap().getBounds(null);
                ViewportModelImpl vmi = (ViewportModelImpl) getMap().getViewportModel();
                vmi.zoomToBox(bounds);
                return;
            }
        }
        else if (isNavigate && (mouseEvent.button == MapMouseEvent.BUTTON1)) {
            selectedLayer = nextLayer != null ? nextLayer : activeLayer;
            if( activeLayer != null ){
                // please stay on the active layer until you have a geometry
                if( geometry == null || !geometry.contains( testLocation)){
                    // we need a selected geometry before we let people navigate away
                    selectedLayer = activeLayer;
                }
            }
        }
       
        if( selectedLayer == null){
            return; // nothing to do!
        }
        if (!selectedLayer.getInteraction(Interaction.AOI)){
            return; // eek!
        }
        // use the bbox to see if we hit anything!
        SimpleFeatureCollection featureCollection = getFeaturesInBbox(selectedLayer, bbox, monitor);
       
        if (featureCollection.isEmpty()) {
            // the user did not click on anything useful (so sad)!
            // see if they were trying to click around on the active layer instead!
            if( selectedLayer == activeLayer){
                return; // give up no change to AOI stuffs
            }
            else {
                // quickly test to see if they clicked on a neighbour
                SimpleFeatureCollection testCollection = getFeaturesInBbox(activeLayer, bbox, monitor);
                if(!testCollection.isEmpty() ){
                    // okay let us go to neighbour
                    selectedLayer = activeLayer;
                    featureCollection = testCollection;
                }
                else {
                    return; // user really did not find anything to click on
                }
            }
        }       
        bounds = featureCollection.getBounds();
        Geometry newAOI = unionGeometry(featureCollection);
       
        updateAOIService(selectedLayer,newAOI );

        if (isNavigate) {
            IMap map = selectedLayer.getMap();
            ViewportModelImpl vmi = (ViewportModelImpl) map.getViewportModel();
            vmi.zoomToBox(bounds);
        }
    }
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

     * Set the geometry to be used as the AOI
     *
     * @param geometry The geometry to use as the AOI must be type Polygon or Multy Polygon
     */
    public void setGeometry( Geometry geometry ) {
        ILayer victim = getActiveLayer();
        IBlackboard mapBlackboard;
        if( victim != null ){
            IBlackboard blackboard = victim.getBlackboard();
            if( geometry != null ){
                blackboard.put(AOI_GEOMETRY, geometry );           
            }
            else {
                blackboard.remove(AOI_GEOMETRY);
            }
            mapBlackboard = victim.getMap().getBlackboard();
        }
        else {
            IMap activeMap = ApplicationGIS.getActiveMap();
            if( activeMap == null){
                return;
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

     * (non-Javadoc)
     * @see org.locationtech.udig.aoi.IAOIStrategy#getAOI()
     */
    @Override
    public Geometry getGeometry() {
        ILayer victim = getActiveLayer();
        if( victim == null ){
            return null;
        }
        IBlackboard blackboard = victim.getBlackboard();
        Geometry geometry = (Geometry) blackboard.get(AOI_GEOMETRY );
        return geometry;
    }
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

     * (non-Javadoc)
     * @see org.locationtech.udig.aoi.IAOIStrategy#getCrs()
     */
    @Override
    public CoordinateReferenceSystem getCrs() {
        ILayer activeLayer = getActiveLayer();
        if( activeLayer == null ){
            return null; // I am confused please try again
        }
        return activeLayer.getCRS();
    }
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

     */
    public ILayer getActiveLayer() {
        IMap map = ApplicationGIS.getActiveMap();
       
        // check if this map has a AOI layer marked already
        ILayer layer = restoreFromMapBlackboard(map);
        if( layer != null ){
            return layer;
        }
       
        // fine we will assume the last AOI layer for this map
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

     *
     * @return The next layer; or null if it is not available.
     */
    public ILayer getNextLayer() {
        List<ILayer> layers = getAOILayers();
        ILayer activeLayer = getActiveLayer();
       
        int index = layers.indexOf(activeLayer);
        if (index < layers.size()-1) {
            return layers.get(index+1);
        }
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

     * layers are considered.
     *
     * @return The previous layer if available; or null if we are already the "last" layer
     */
    public ILayer getPreviousLayer() {
        ILayer activeLayer = getActiveLayer();
        if (activeLayer == null) {
            return null; // nothing to see here move along
        }       
        List<ILayer> layers = getAOILayers();
        int index = layers.indexOf(activeLayer);
        if (index > 0) {
            ILayer previousLayer = layers.get( index-1 );
            return previousLayer;
        }
        return null;
    }
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

            setCombo(parent);
            listenAOILayer(true);

            // set the list of layers and the active layer
            List<ILayer> layers = getAOILayerStrategy().getAOILayers();
            ILayer activeLayer = getAOILayerStrategy().getActiveLayer();
            comboViewer.setInput(layers);
            if (!layers.isEmpty()) {
                comboViewer.setInput(layers);
                if (activeLayer == null) {
                    activeLayer = layers.get(0);
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

            comboViewer.setLabelProvider(new LabelProvider(){
                @Override
                public String getText( Object element ) {
                    if (element instanceof ILayer) {
                        ILayer layer = (ILayer) element;
                        return layer.getName();
                    }
                    return super.getText(element);
                }
            });
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.