Layers to snap bug

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Layers to snap bug

Flavio Pompermaier-2
Hi to all,
I'm using gvSIG 1.10 and I discovered that there's a bug (not critical however) for what concerns the editing snapping.

When you have some vectorial layer in editing and you put another vectorial layer to editing,
this last does not snap to other already editing layers (whereas the SnapConfigPage tells you so...).
This is because the SnapConfigPage assumes that all vectorial layers in editing snap to each other, but this is not true..
so, or the SnapConfigPage is to correct or, when a layer is put in editing,
gvSIG add other edited layers (at least those belonging to the same parent FLayers) to its snappableLayers (I prefer this last option).

This last option could be achieved through this code in the StartEditing class:

                   VectorialEditableAdapter vea = (VectorialEditableAdapter) lv.getSource();
                    vea.getRules().clear();
                    if (vea.getShapeType() == FShape.POLYGON)
                    {
                        IRule rulePol = new RulePolygon();
                        vea.getRules().add(rulePol);
                    }
                    final ILayerEdited layerEdited = editionManager.getLayerEdited(lv);
                    if(layerEdited instanceof VectorialLayerEdited){
                        VectorialLayerEdited vle=(VectorialLayerEdited)layerEdited;
                        if (!(lv.getSource().getDriver() instanceof IndexedShpDriver)){
                            vle.setLegend(legendOriginal);
                        }
                        FLayers layers = lv.getParentLayer();
                        ArrayList layersToSnap = vle.getLayersToSnap();
                        for (int i = 0;layers !=null &&  i < layers.getLayersCount(); i++) {
                            FLayer l= layers.getLayer(i);
                            if(l instanceof FLyrVect){
                            FLyrVect aux = (FLyrVect) l;
                            if (aux.isEditing() && !layersToSnap.contains(aux))
                                layersToSnap.add(aux);
                            }
                        }
                        vle.setLayersToSnap(layersToSnap);
                        mapControl.getMapContext().invalidate();
                    }

Best regards,
Flavio

_______________________________________________
gvSIG-desktop-devel mailing list
[hidden email]
https://lists.forge.osor.eu/listinfo/gvsig-desktop-devel
Reply | Threaded
Open this post in threaded view
|

Re: Layers to snap bug

Jorge Piera Llodrá
Hello Flavio.

I'm not completely sure if I've understood you.

I've loaded two layers and I've put them on edition at the same time. I've selected the edition properties of both and I've applied the snapping to the two layers. When I'm editing any layer the snapping works in all of them. Where is the problem? Could you please give us more details?

By the other hand I cannot recognize the code that you sent in the gvSIG source code. Could you please send us the class and the method where you want to update this code?

Best Regards,
Jorge.

On 06/16/2011 10:08 AM, Flavio Pompermaier wrote:
Hi to all,
I'm using gvSIG 1.10 and I discovered that there's a bug (not critical however) for what concerns the editing snapping.

When you have some vectorial layer in editing and you put another vectorial layer to editing,
this last does not snap to other already editing layers (whereas the SnapConfigPage tells you so...).
This is because the SnapConfigPage assumes that all vectorial layers in editing snap to each other, but this is not true..
so, or the SnapConfigPage is to correct or, when a layer is put in editing,
gvSIG add other edited layers (at least those belonging to the same parent FLayers) to its snappableLayers (I prefer this last option).

This last option could be achieved through this code in the StartEditing class:

                   VectorialEditableAdapter vea = (VectorialEditableAdapter) lv.getSource();
                    vea.getRules().clear();
                    if (vea.getShapeType() == FShape.POLYGON)
                    {
                        IRule rulePol = new RulePolygon();
                        vea.getRules().add(rulePol);
                    }
                    final ILayerEdited layerEdited = editionManager.getLayerEdited(lv);
                    if(layerEdited instanceof VectorialLayerEdited){
                        VectorialLayerEdited vle=(VectorialLayerEdited)layerEdited;
                        if (!(lv.getSource().getDriver() instanceof IndexedShpDriver)){
                            vle.setLegend(legendOriginal);
                        }
                        FLayers layers = lv.getParentLayer();
                        ArrayList layersToSnap = vle.getLayersToSnap();
                        for (int i = 0;layers !=null &&  i < layers.getLayersCount(); i++) {
                            FLayer l= layers.getLayer(i);
                            if(l instanceof FLyrVect){
                            FLyrVect aux = (FLyrVect) l;
                            if (aux.isEditing() && !layersToSnap.contains(aux))
                                layersToSnap.add(aux);
                            }
                        }
                        vle.setLayersToSnap(layersToSnap);
                        mapControl.getMapContext().invalidate();
                    }

Best regards,
Flavio
_______________________________________________ gvSIG-desktop-devel mailing list [hidden email] https://lists.forge.osor.eu/listinfo/gvsig-desktop-devel


-- 
Jorge Piera Llodrá
gvSIG Development Team
PRODEVELOP
Plaza Don Juan de Villarrasa, 14 - 5
46001 Valencia
Tel: +34 963510612
Fax: +34 963510908
e-mail: [hidden email]
http://www.prodevelop.es
http://www.gvsig.org

_______________________________________________
gvSIG-desktop-devel mailing list
[hidden email]
https://lists.forge.osor.eu/listinfo/gvsig-desktop-devel
Reply | Threaded
Open this post in threaded view
|

Re: Layers to snap bug

Flavio Pompermaier-2
The code I suggested belongs to the StartEditing class and it adds all layers in editing mode to snappable layers of the of the one whose is entering in editing mode.
However, this feature is not so useful if the SnapConfigPage works correctly (I had a try from an empty view and the snapping was set only for the layer that is entering in editing mode, and not automatically to all edited layers as I wrote in the email..).
So, I think this happens only in my project but I don't know why...I'll give a look..

Thanks for the reply,
Flavio

2011/6/16 Jorge Piera Llodrá <[hidden email]>
Hello Flavio.

I'm not completely sure if I've understood you.

I've loaded two layers and I've put them on edition at the same time. I've selected the edition properties of both and I've applied the snapping to the two layers. When I'm editing any layer the snapping works in all of them. Where is the problem? Could you please give us more details?

By the other hand I cannot recognize the code that you sent in the gvSIG source code. Could you please send us the class and the method where you want to update this code?

Best Regards,
Jorge.


On 06/16/2011 10:08 AM, Flavio Pompermaier wrote:
Hi to all,
I'm using gvSIG 1.10 and I discovered that there's a bug (not critical however) for what concerns the editing snapping.

When you have some vectorial layer in editing and you put another vectorial layer to editing,
this last does not snap to other already editing layers (whereas the SnapConfigPage tells you so...).
This is because the SnapConfigPage assumes that all vectorial layers in editing snap to each other, but this is not true..
so, or the SnapConfigPage is to correct or, when a layer is put in editing,
gvSIG add other edited layers (at least those belonging to the same parent FLayers) to its snappableLayers (I prefer this last option).

This last option could be achieved through this code in the StartEditing class:

                   VectorialEditableAdapter vea = (VectorialEditableAdapter) lv.getSource();
                    vea.getRules().clear();
                    if (vea.getShapeType() == FShape.POLYGON)
                    {
                        IRule rulePol = new RulePolygon();
                        vea.getRules().add(rulePol);
                    }
                    final ILayerEdited layerEdited = editionManager.getLayerEdited(lv);
                    if(layerEdited instanceof VectorialLayerEdited){
                        VectorialLayerEdited vle=(VectorialLayerEdited)layerEdited;
                        if (!(lv.getSource().getDriver() instanceof IndexedShpDriver)){
                            vle.setLegend(legendOriginal);
                        }
                        FLayers layers = lv.getParentLayer();
                        ArrayList layersToSnap = vle.getLayersToSnap();
                        for (int i = 0;layers !=null &&  i < layers.getLayersCount(); i++) {
                            FLayer l= layers.getLayer(i);
                            if(l instanceof FLyrVect){
                            FLyrVect aux = (FLyrVect) l;
                            if (aux.isEditing() && !layersToSnap.contains(aux))
                                layersToSnap.add(aux);
                            }
                        }
                        vle.setLayersToSnap(layersToSnap);
                        mapControl.getMapContext().invalidate();
                    }

Best regards,
Flavio
_______________________________________________ gvSIG-desktop-devel mailing list [hidden email] https://lists.forge.osor.eu/listinfo/gvsig-desktop-devel


-- 
Jorge Piera Llodrá
gvSIG Development Team
PRODEVELOP
Plaza Don Juan de Villarrasa, 14 - 5
46001 Valencia
Tel: +34 963510612
Fax: +34 963510908
e-mail: [hidden email]
http://www.prodevelop.es
http://www.gvsig.org

_______________________________________________
gvSIG-desktop-devel mailing list
[hidden email]
https://lists.forge.osor.eu/listinfo/gvsig-desktop-devel



_______________________________________________
gvSIG-desktop-devel mailing list
[hidden email]
https://lists.forge.osor.eu/listinfo/gvsig-desktop-devel