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

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


        boolean altUp=!e.isAltDown();
        boolean button1Changed=(e.button^MapMouseEvent.BUTTON1)==0;
       
        if ( !(currentGeomNotNull && eventTypePressed&& singleModifierDown&&altUp&&button1Changed) )
            return false;
        EditGeom geom = handler.getCurrentGeom();
        return geom.hasVertex(geom.getEditBlackboard().overVertex(Point.valueOf(e.x, e.y), PreferenceUtil.instance().getVertexRadius()));
    }
View Full Code Here


    public void testIsValid() throws Exception {
        AcceptChangesBehaviour behaviour=new AcceptChangesBehaviour(Polygon.class, false);
       
        // currentGeom is null
        assertFalse(behaviour.isValid(handler));
        EditGeom editGeom = handler.getEditBlackboard().getGeoms().get(0);
        handler.setCurrentShape(editGeom.getShell());
       
       
        // current Geom has no points
        handler.getEditBlackboard().addPoint(10,10,editGeom.getShell());
        assertTrue(behaviour.isValid(handler));      
    }
View Full Code Here

    public void testPolygon() throws Exception {
        AcceptChangesBehaviour behaviour;
        FeatureIterator<SimpleFeature> features;
        SimpleFeature next;
        EditBlackboard bb = handler.getEditBlackboard();
        EditGeom editGeom = bb.getGeoms().get(0);

        handler.setCurrentShape(editGeom.getShell());
       
           // test create Polygon
        bb.addPoint(10,10,editGeom.getShell());
        bb.addPoint(40,10,editGeom.getShell());
        bb.addPoint(40,40,editGeom.getShell());
        bb.addPoint(10,10,editGeom.getShell());
       
        PrimitiveShape hole = editGeom.newHole();
        bb.addPoint(20,20,hole);
        bb.addPoint(30,30,hole);
        bb.addPoint(30,20,hole);
        bb.addPoint(20,20,hole);
       
View Full Code Here

    public void testMultiPolygon() throws Exception {
        AcceptChangesBehaviour behaviour;
        FeatureIterator<SimpleFeature> features;
        SimpleFeature next;
        EditBlackboard bb = handler.getEditBlackboard();
        EditGeom editGeom = bb.getGeoms().get(0);

        SimpleFeatureType type = DataUtilities.createType("MultiPolygon", "*geom:MultiPolygon"); //$NON-NLS-1$ //$NON-NLS-2$
        feature = SimpleFeatureBuilder.template(type, feature.getID());
        ((TestLayer)handler.getContext().getMap().getMapLayers().get(0)).setSchema(type);
       ((Map)handler.getContext().getMap()).getEditManagerInternal().setEditFeature(feature, layer);

        handler.setCurrentShape(bb.getGeoms().get(0).getShell());
       
           // test create MultiPolygon
        bb.addPoint(10,10,editGeom.getShell());
        bb.addPoint(40,10,editGeom.getShell());
        bb.addPoint(40,40,editGeom.getShell());
        bb.addPoint(10,10,editGeom.getShell());
       
        PrimitiveShape hole = editGeom.newHole();
        bb.addPoint(20,20,hole);
        bb.addPoint(30,20,hole);
        bb.addPoint(30,30,hole);
        bb.addPoint(20,20,hole);
       
View Full Code Here

        AcceptChangesBehaviour behaviour;
        FeatureIterator<SimpleFeature> features;
        SimpleFeature next;
       
        EditBlackboard bb = handler.getEditBlackboard();
        EditGeom editGeom = bb.getGeoms().get(0);

        handler.setCurrentShape(editGeom.getShell());

        bb.addPoint(10,10,editGeom.getShell());
        bb.addPoint(40,10,editGeom.getShell());
    
        SimpleFeatureType type = DataUtilities.createType("MultiLine", "*geom:MultiLineString"); //$NON-NLS-1$ //$NON-NLS-2$
        feature = SimpleFeatureBuilder.template(type, feature.getID());
        ((TestLayer)handler.getContext().getMap().getMapLayers().get(0)).setSchema(type);
        ((Map)handler.getContext().getMap()).getEditManagerInternal().setEditFeature(feature, layer);
View Full Code Here

        AcceptChangesBehaviour behaviour;
        FeatureIterator<SimpleFeature> features;
        SimpleFeature next;
       
        EditBlackboard bb = handler.getEditBlackboard();
        EditGeom editGeom = bb.getGeoms().get(0);

        handler.setCurrentShape(editGeom.getShell());

        bb.addPoint(10,10,editGeom.getShell());
        bb.addPoint(40,10,editGeom.getShell());
       
        // test create LineString
        behaviour=new AcceptChangesBehaviour(LineString.class, false);
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap(handler.getContext().getMap());
View Full Code Here

    @Test
    public void testPoint() throws Exception {
        AcceptChangesBehaviour behaviour=new AcceptChangesBehaviour(Point.class, false);

        EditBlackboard bb = handler.getEditBlackboard();
        EditGeom editGeom = bb.getGeoms().get(0);

        bb.addPoint(10,10,editGeom.getShell());
       
        try{
            behaviour.getCommand(handler);
            fail();
        }catch (IllegalArgumentException e) {
            // good
        }
       
        handler.setCurrentShape(editGeom.getShell());
       
        // test create point
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap(handler.getContext().getMap());
        command.run(new NullProgressMonitor());
View Full Code Here

        NullProgressMonitor nullProgressMonitor = new NullProgressMonitor();
        FeatureSource<SimpleFeatureType, SimpleFeature> source = layer.getResource(FeatureSource.class, nullProgressMonitor);
        int count=source.getCount(Query.ALL);
       
        EditBlackboard bb = handler.getEditBlackboard();
        EditGeom editGeom = bb.getGeoms().get(0);

        bb.addPoint(10,10,editGeom.getShell());

        handler.setCurrentShape(editGeom.getShell());
       UndoableMapCommand command = behaviour.getCommand(handler);
       command.setMap((Map) handler.getContext().getMap());
       nullProgressMonitor = new NullProgressMonitor();
       command.run(nullProgressMonitor);
       assertFalse(handler.getCurrentGeom().isChanged());
View Full Code Here

     */
    @Ignore
    @Test
    public void testMultiPointOnBlackboard() throws Exception {
        EditBlackboard bb = handler.getEditBlackboard();
        EditGeom geom = bb.newGeom(feature.getID(), ShapeType.POINT);
        bb.addPoint(10,10,geom.getShell());
        handler.setCurrentShape(geom.getShell());
       
        EditGeom geom2 = bb.newGeom(feature.getID(), ShapeType.POINT);
        bb.addPoint(20,20, geom2.getShell());
       
        AcceptChangesBehaviour behaviour = new AcceptChangesBehaviour(Point.class, false);
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap((Map) handler.getContext().getMap());
        command.run(new NullProgressMonitor());
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testTwoChangedFeaturesOnBlackboard() throws Exception {
        EditBlackboard bb = handler.getEditBlackboard();
        EditGeom geom1 = bb.newGeom(feature.getID(), null);
        bb.addPoint(10,10, geom1.getShell());
        bb.addPoint(20,10, geom1.getShell());
        bb.addPoint(20,20, geom1.getShell());
        bb.addPoint(10,10, geom1.getShell());
        handler.setCurrentShape(geom1.getShell());
       
        EditGeom geom2 = bb.newGeom(feature2.getID(), null);
       
        bb.addPoint(100,100, geom2.getShell());
        bb.addPoint(200,100, geom2.getShell());
        bb.addPoint(200,200, geom2.getShell());
        bb.addPoint(100,100, geom2.getShell());
       
        AcceptChangesBehaviour behaviour=new AcceptChangesBehaviour(LineString.class, false);
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap((Map) handler.getContext().getMap());
        command.run(new NullProgressMonitor());
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.