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

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


    }

    public UndoableMapCommand getCommand( EditToolHandler handler, MapMouseEvent e,
            EventType eventType ) {
        EditBlackboard editBlackboard = handler.getCurrentShape().getEditBlackboard();
        Point point=editBlackboard.overVertex(Point.valueOf(e.x, e.y),
                PreferenceUtil.instance().getVertexRadius());
        if( point.equals(handler.getCurrentShape().getPoint(0))){
            List<UndoableMapCommand> commands=new ArrayList<UndoableMapCommand>();
            commands.add(new ReversePointsInShapeCommand(handler, handler.getCurrentShape()));
            commands.add(new SetEditStateCommand(handler, EditState.CREATING));
            return new UndoableComposite(commands);
        }else
View Full Code Here


        && !e.buttonsDown() && !e.modifiersDown() && overGeomVertex(handler, e);
    }

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

    public UndoableMapCommand getCommand( EditToolHandler handler, MapMouseEvent e,
            EventType eventType ) {
        if( !isValid(handler, e, eventType) )
            throw new IllegalStateException("isValid() return false"); //$NON-NLS-1$

        Point vertexOver=handler.getEditBlackboard(handler.getEditLayer()).overVertex(Point.valueOf(e.x, e.y),
                PreferenceUtil.instance().getVertexRadius());
       
        UndoableComposite command=new UndoableComposite();
        EditBlackboard bb = handler.getCurrentShape().getEditBlackboard();
        command.getCommands().add(new SelectVertexCommand(bb, vertexOver, Type.SET));
View Full Code Here

        return null;
    }
   

    private boolean onEdge( EditToolHandler handler, MapMouseEvent e ) {
        Point point = Point.valueOf(e.x,e.y);
        EditGeom geom = handler.getCurrentGeom();
        if( geom==null )
            return false;

        ILayer selectedLayer = handler.getEditLayer();
View Full Code Here

    private boolean overVertex(EditToolHandler handler, MapMouseEvent e) {
        if( handler.getCurrentShape()==null )
            return false;
        int radius = PreferenceUtil.instance().getVertexRadius();
        Point point = Point.valueOf(e.x,e.y);
        return handler.getCurrentGeom().overVertex(point, radius)!=null;
    }
View Full Code Here

       
        if ( !( legalState && legalEventType && shapeAndGeomNotNull && button1Released
        && !e.buttonsDown() && !e.modifiersDown() && selectedShapeIsPolygon) )
            return false;
       
        Point point=Point.valueOf(e.x, e.y);
       
        if( !currentGeom.getShell().contains(point, true) )
            return false;
       
        for( PrimitiveShape shape : currentGeom.getHoles() ) {
View Full Code Here

        }
        return new UndoRedoCommand(command);
    }

    private void updateShapes( EditToolHandler handler, MapMouseEvent e ) {
        Point dragStarted = handler.getMouseTracker().getDragStarted();
        if( isOverEndPoint(e, PreferenceUtil.instance().getVertexRadius(), dragStarted)){
            drawEndPoints.setFill(PreferenceUtil.instance().getDrawVertexFillColor());
        }else{
            drawEndPoints.setFill(null);           
        }
       
        if (type == ShapeType.POLYGON)
            drawShapeCommand.line(e.x, e.y, dragStarted.getX(), dragStarted.getY());

        handler.repaint();
    }
View Full Code Here

    }

    private UndoableMapCommand init( final EditToolHandler handler, MapMouseEvent e, EventType eventType ) {
        if( !handler.isLockOwner(this) )
            handler.lock(this);
        Point dragStarted = handler.getMouseTracker().getDragStarted();
        if( creator!=null )
            handler.getBehaviours().remove(creator);
        creator = new Creator(dragStarted);
        initDrawCommands(handler, dragStarted);
        handler.getBehaviours().add(creator);

        ILayer selectedLayer = handler.getEditLayer();
        EditBlackboard editBlackboard = handler.getEditBlackboard(selectedLayer);
        int vertexRadius = PreferenceUtil.instance().getVertexRadius();
        Point nearestPoint = editBlackboard.overVertex(dragStarted, vertexRadius);

        if( nearestPoint==null )
            nearestPoint=dragStarted;
       
        initShapePath(nearestPoint);

        SimpleFeatureType schema = selectedLayer.getSchema();
        determineShapeType(schema);
       
        if( type==ShapeType.POLYGON && EditPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.P_FILL_POLYGONS) ){
            drawShapeCommand.setFill(PreferenceUtil.instance().getDrawGeomsFill());
        }
       
        EditBlackboard blackboard = editBlackboard;
        PrimitiveShape currentShape = handler.getCurrentShape();
        if (currentShape == null) {
            UndoableComposite undoableComposite = startNewShape(handler, blackboard);
            return undoableComposite;
        }

        currentShape=currentShape.getEditGeom().getShell();
       
        //if current shape is a line and point matches up with one of the end points then
        // continue line.
        if( currentShape.getEditGeom().getShapeType()==ShapeType.LINE ){
            if( currentShape.getNumPoints()>0 && nearestPoint.equals(currentShape.getPoint(0)) ){
                // over the first end point so reverse order and return;
                EditUtils.instance.reverseOrder(currentShape);
                return null;
            }
           
            if( currentShape.getNumPoints()>1 && !nearestPoint.equals(currentShape.getPoint(currentShape.getNumPoints()-1)) ){
                // not over one of the end points
                return createNewGeom(handler);
            }
            return null;
        }
View Full Code Here

        return legalState && legalEventType && shapeAndGeomNotNull && button1Released
        && !e.buttonsDown() && !e.modifiersDown() && overFirstVertex(handler, e);
    }
   
    private boolean overFirstVertex(EditToolHandler handler, MapMouseEvent e) {
        Point vertexOver=handler.getEditBlackboard(handler.getEditLayer()).overVertex(Point.valueOf(e.x, e.y),
                PreferenceUtil.instance().getVertexRadius());
       
        return handler.getCurrentShape().getNumPoints()>0 && handler.getCurrentShape().getPoint(0).equals(vertexOver);
    }
View Full Code Here

    private boolean allVerticesSelectedAndWithinGeom( EditToolHandler handler ) {
        PrimitiveShape currentShape = handler.getCurrentShape();
        Selection selection = handler.getCurrentGeom().getEditBlackboard().getSelection();

        Point dragStarted = handler.getMouseTracker().getDragStarted();
        if( dragStarted==null )
            return false;
        for( Point point : currentShape ) {
            if( ! selection.contains(point) )
                return false;
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.