Package org.locationtech.udig.tools.edit.support

Examples of org.locationtech.udig.tools.edit.support.Point


    private boolean startedOverSelectedVertex( EditToolHandler handler ) {
        // if tracker!=null then the move has started so the selection is no longer
        // at the same spot as the selected point so return true
        if (tracker != null)
            return true;
        Point started = handler.getMouseTracker().getDragStarted();
        EditBlackboard editBlackboard = handler.getEditBlackboard(handler.getEditLayer());
        Point point = handler.getEditBlackboard(handler.getEditLayer())
                .overVertex(Point.valueOf(started.getX(), started.getY()),
                        PreferenceUtil.instance().getVertexRadius());
        if (point == null) {
            point = Point.valueOf(started.getX(), started.getY());
        }
View Full Code Here


        EditBlackboard editBlackboard2 = handler.getEditBlackboard(handler.getEditLayer());
        editBlackboard2.startBatchingEvents();
        try {
            if (tracker == null) {
                handler.lock(this);
                Point closestPoint = editBlackboard2.overVertex(Point.valueOf(e.x, e.y),
                        PreferenceUtil.instance().getVertexRadius(), false);
                Map<EditGeom, Boolean> changedStatus=new HashMap<EditGeom, Boolean>();
                for( EditGeom geom : editBlackboard2.getGeoms() ) {
                    changedStatus.put(geom, geom.isChanged());
                }
               
                IEditValidator validator = validatorFactory.get(handler, e, eventType);

                // If at the start the geometry isn't valid then who are we to complain?
                if( validator.isValid(handler, e, eventType)!=null ){
                  validator=null;
                }
               
                tracker = new PositionTracker(closestPoint, handler.getMouseTracker()
                        .getDragStarted(), getPointsToMove(handler, editBlackboard2),
                        changedStatus, validator);
                handler.getBehaviours().add(tracker);
                if (isSnappingValid() && PreferenceUtil.instance().getSnapBehaviour()!=SnapBehaviour.GRID ) {
                        drawSnapArea = new DrawSnapAreaCommand(tracker);
                    handler.getContext().getViewportPane().addDrawCommand(drawSnapArea);

                }
            }

            if (tracker.lastPoint == null) {
                tracker.lastPoint = handler.getMouseTracker().getDragStarted();
            }

            Point point = Point.valueOf(e.x, e.y);

            int deltaX = point.getX() - tracker.lastPoint.getX(), deltaY = point.getY()
                    - tracker.lastPoint.getY();

            doMove(deltaX, deltaY, handler, editBlackboard2, tracker.selection);

            tracker.lastPoint = point;
View Full Code Here

            handler.getBehaviours().add(selectBehaviour);
            drawShapeCommand = new SelectionBoxCommand();
           
            handler.getContext().getViewportPane().addDrawCommand(drawShapeCommand);
        }
        Point start = handler.getMouseTracker().getDragStarted();
        drawShapeCommand.setShape(new Rectangle(Math.min(start.getX(), e.x), Math.min(
                start.getY(), e.y), Math.abs(start.getX() - e.x), Math.abs(start.getY()
                - e.y)));
       
        handler.repaint();
       
        return null;
View Full Code Here

                Set<Point> points = new HashSet<Point>();
                Rectangle rect=(Rectangle) drawShapeCommand.getShape();
                EditGeom geom = handler.getCurrentGeom();
                for( int x=rect.x, maxx=(int) rect.getMaxX(); x<maxx; x++){
                    for( int y=rect.y, maxy=(int) rect.getMaxY(); y<maxy; y++){
                        Point valueOf = Point.valueOf(x,y);
                        if( geom.hasVertex(valueOf))
                            points.add(valueOf);
                    }
                }
               
View Full Code Here

        return edge.getDistanceToEdge()<=PreferenceUtil.instance().getVertexRadius();
    }

    private boolean overShapeVertex(EditToolHandler handler, MapMouseEvent e) {
       
        Point vertexOver=handler.getEditBlackboard(handler.getEditLayer()).overVertex(Point.valueOf(e.x, e.y),
                PreferenceUtil.instance().getVertexRadius());
       
        return handler.getCurrentShape().hasVertex( vertexOver );
    }
View Full Code Here

            throw new IllegalStateException("Cannot insert a vertext here"); //$NON-NLS-1$
        }
        ILayer editLayer = handler.getEditLayer();

        EditBlackboard editBlackboard = handler.getEditBlackboard( editLayer );       
        Point toInsert = Point.valueOf(e.x,e.y);
       
        return new InsertOnNearestEdgeCommand( handler, editBlackboard, toInsert );

    }
View Full Code Here

    public UndoableMapCommand getCommand( EditToolHandler handler, MapMouseEvent e, EventType eventType ) {
        if( !isValid(handler, e, eventType) )
            throw new IllegalArgumentException("Not valid state", new Exception()); //$NON-NLS-1$

        EditBlackboard editBlackboard = handler.getEditBlackboard(handler.getEditLayer());
        Point point = handler.getEditBlackboard(handler.getEditLayer()).overVertex(Point.valueOf(e.x,e.y), PreferenceUtil.instance().getVertexRadius());
        List<EditGeom> geoms = null;
        if( point != null )
            geoms= editBlackboard.getGeoms(point.getX(),point.getY());
        else{
            EditPlugin.trace(EditPlugin.SELECTION, "VertexSelectorBehaviour: Not over vertex (" //$NON-NLS-1$
                    +e.x+","+e.y+")", null); //$NON-NLS-1$ //$NON-NLS-2$
        }
        Selection selection = editBlackboard.getSelection();
View Full Code Here

    public UndoableMapCommand getCommand( EditToolHandler handler, MapMouseEvent e, EventType eventType ) {
        if( !isValid(handler, e, eventType) )
            throw new IllegalArgumentException("Not valid state", new Exception()); //$NON-NLS-1$

        EditBlackboard editBlackboard = handler.getEditBlackboard(handler.getEditLayer());
        Point point = handler.getEditBlackboard(handler.getEditLayer()).overVertex(Point.valueOf(e.x,e.y), PreferenceUtil.instance().getVertexRadius());
        List<EditGeom> geoms = null;
        if( point != null )
            geoms= editBlackboard.getGeoms(point.getX(),point.getY());
        else{
            EditPlugin.trace(EditPlugin.SELECTION, "VertexSelectorBehaviour: Not over vertex (" //$NON-NLS-1$
                    +e.x+","+e.y+")", null); //$NON-NLS-1$ //$NON-NLS-2$
            return null;
        }
View Full Code Here

        boolean legalState=handler.getCurrentState()==EditState.CREATING;
        boolean legalEventType=eventType==EventType.RELEASED || eventType==EventType.DOUBLE_CLICK;
        boolean shapeAndGeomNotNull=handler.getCurrentShape()!=null;
        boolean button1Released=e.button==MapMouseEvent.BUTTON1;
       
        Point point = Point.valueOf(e.x, e.y);
       
        return legalState && legalEventType && shapeAndGeomNotNull && button1Released
        && !e.buttonsDown() && !e.modifiersDown() && isNotDuplicated(handler, point);
    }
View Full Code Here

        ILayer editLayer = handler.getEditLayer();
       
        EditBlackboard editBlackboard = handler.getEditBlackboard(editLayer);
        final int vertexRadius = PreferenceUtil.instance().getVertexRadius();
       
        Point vertexOver=editBlackboard.overVertex(point, vertexRadius);
       
        if( vertexOver == null ) {
            // we are not over any points
            return true;            
        }
        if( currentShape.getNumPoints() > 2 && vertexOver.equals( currentShape.getPoint(0) )) {
            // forms a closed linestring or polygon
            return true;
        }
        return !currentShape.hasVertex( vertexOver ) ;       
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.tools.edit.support.Point

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.