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

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


  public void changed(EditManagerEvent event) {
    int type = event.getType();
    if(type == EditManagerEvent.EDIT_FEATURE){
     
      EditGeom currentGeom = handler.getCurrentGeom();
      SimpleFeature newValue = (SimpleFeature) event.getNewValue();
      if( currentGeom==null && newValue!=null ){
        setCurrentGeom(newValue);
      } else if( currentGeom!=null && newValue==null ) {
        handler.setCurrentShape(null);
View Full Code Here


    Map<Geometry, EditGeom> editGeoms = bb.setGeometries((Geometry) newValue.getDefaultGeometry(), newValue.getID());
    if( editGeoms.isEmpty() ){
      return;
    }
   
    EditGeom firstShape = editGeoms.values().iterator().next();
    handler.setCurrentShape(firstShape.getShell());
  }
View Full Code Here

        assertEquals( org.locationtech.udig.tools.edit.support.Point.valueOf(10,0), handler.getCurrentGeom().getShell().getPoint(0));
        assertTrue( l.set  );
        assertNull(l.old);
        assertEquals( handler.getCurrentGeom(), l.current);

        EditGeom geom=l.added.get(l.added.size()-1);
        handler.handleEvent(new MapMouseEvent(null, 20, 0, none, none, button1), EventType.RELEASED);
        assertEquals( org.locationtech.udig.tools.edit.support.Point.valueOf(20,0), handler.getCurrentGeom().getShell().getPoint(0));
        assertTrue( l.set  );
        assertEquals(geom,l.old);
        assertEquals( handler.getCurrentGeom(), l.current);
View Full Code Here

     * MapMouseEvent, EventType)'
     */
    @Test
    public void testGetCommand() {

        EditGeom geom = handler.getCurrentGeom();
        PrimitiveShape hole = geom.newHole();
        EditBlackboard bb = handler.getEditBlackboard();

        bb.addPoint(5, 5, hole);
        bb.addPoint(25, 5, hole);
        bb.addPoint(25, 25, hole);
View Full Code Here

        //Current Shape must be set
        MapMouseEvent event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));
       
        EditGeom editGeom = handler.getEditBlackboard().getGeoms().get(0);
        handler.setCurrentShape(editGeom.getShell());
        handler.getEditBlackboard().addPoint(11,11, handler.getCurrentShape());
       
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertTrue(behavior.isValid(handler, event, EventType.RELEASED));
        // no buttons should be down
View Full Code Here

        //Current Shape must be set
        MapMouseEvent event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));
       
        EditGeom editGeom = handler.getEditBlackboard().getGeoms().get(0);
       
        handler.setCurrentShape(editGeom.getShell());
        handler.getEditBlackboard().addPoint(0,0, handler.getCurrentShape());
       
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        // mouse must be within a shell
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));
View Full Code Here

            // good
        }
       
        handler.setCurrentState(EditState.MODIFYING);

        EditGeom editGeom = handler.getEditBlackboard().getGeoms().get(0);
        handler.setCurrentShape(editGeom.getShell());

        handler.getEditBlackboard().addPoint(0,0, handler.getCurrentShape());
        handler.getEditBlackboard().addPoint(100,0, handler.getCurrentShape());
        handler.getEditBlackboard().addPoint(100,100, handler.getCurrentShape());
        handler.getEditBlackboard().addPoint(0,100, handler.getCurrentShape());
        handler.getEditBlackboard().addPoint(0,0, handler.getCurrentShape());
       
        UndoableMapCommand command = behavior.getCommand(handler, event, EventType.RELEASED);
       
        command.setMap((Map) handler.getContext().getMap());
        if (command instanceof PostDeterminedEffectCommand) {
            PostDeterminedEffectCommand c = (PostDeterminedEffectCommand) command;
            c.execute(new NullProgressMonitor());
        }else{
            command.run(new NullProgressMonitor());
        }
       
        assertEquals("Current shape should equal new hole", editGeom.getHoles().get(0), handler.getCurrentShape()); //$NON-NLS-1$
        assertEquals("A point should have been added to hole", Point.valueOf(10,10), handler.getCurrentShape().getPoint(0)); //$NON-NLS-1$
        assertEquals( EditState.CREATING, handler.getCurrentState());
       
        command.rollback(new NullProgressMonitor());

        assertEquals( editGeom.getShell(), handler.getCurrentShape());
        assertEquals(0, editGeom.getHoles().size());
        assertEquals( EditState.MODIFYING, handler.getCurrentState());
       
    }
View Full Code Here

        MapMouseEvent event=new MapMouseEvent( DISPLAY, 10,10,NONE,BUTTON1, BUTTON1 );
        assertFalse(mode.isValid(handler, event, EventType.DRAGGED));
       
        editBlackboard = handler.getEditBlackboard();
        EditGeom currentGeom = editBlackboard.getGeoms().get(0);
        editBlackboard.addPoint(10,10, currentGeom.getShell());
        editBlackboard.addPoint(20,10, currentGeom.getShell());
        editBlackboard.addPoint(30,10, currentGeom.getShell());
        handler.setCurrentShape(currentGeom.getShell());
    }
View Full Code Here

    }
   
    @Ignore
    @Test
    public void testPostSnapping() throws Exception {
        EditGeom newGeom = editBlackboard.newGeom("id", null); //$NON-NLS-1$
        editBlackboard.addPoint(30,20, newGeom.getShell());
        editBlackboard.addPoint(30,40, newGeom.getShell());
       
        PreferenceUtil.instance().setSnapBehaviour(SnapBehaviour.ALL_LAYERS);
        handler.getTestEditBlackboard().util.setSnappingRadius(12);
       
        editBlackboard.selectionAdd(Point.valueOf(10,10));
View Full Code Here

        //Current Shape must be set
        MapMouseEvent event = new MapMouseEvent(null, 10,10, MapMouseEvent.BUTTON1, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertFalse(behavior.isValid(handler, event, EventType.DOUBLE_CLICK));
       
        EditGeom editGeom = handler.getEditBlackboard().getGeoms().get(0);
        handler.setCurrentShape(editGeom.getShell());
        editGeom.setChanged(true);
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        assertTrue(behavior.isValid(handler, event, EventType.DOUBLE_CLICK));
        // only button1 should be down
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.BUTTON2, MapMouseEvent.BUTTON1);
        assertFalse(behavior.isValid(handler, event, EventType.DOUBLE_CLICK));
View Full Code Here

TOP

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

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.