Re: selected by ipelet problem.

"Sebastien Loriot (GeometryFactory)" <[email protected]>
Newsgroups gmane.comp.graphics.ipe.general
Organization GeometryFactory
Message-ID <[email protected]>
On 10/07/2012 06:06 AM, Otfried Cheong wrote:
> On 10/05/2012 09:40 PM, Olivier Devillers wrote:
>> Here is the following reproducible problem (on my laptop, macOS)
>> if somebody has an idea...
>>
>>
>> enter few points,
>> select them
>> ask for the Delaunay triangulation (or Voronoi or...)  using CGAL ipelets
>> ---->  the triangulation appear and is selected
>> - If I click on the object with right button, then ipe crashes with
>> message below
>> - If I unselect, select again and click with right button, it works well
>
> This seems to indicate that there is a bug in the ipelet.  This would
> happen if it does not set a primary selection (only secondary
> selections), or perhaps if it sets more than one primary selection.
>
The diagnostic was correct. This will be fixed in the next release of 
CGAL. I attached the patch.

Thanks,

Sebastien.

> Otfried
>
>
>
> _______________________________________________
> Ipe-discuss mailing list
> Ipe-discuss-rGrgPyRx506NN8uzcEdRPYRWq/[email protected]
> http://lists.science.uu.nl/mailman/listinfo/ipe-discuss

_______________________________________________
Ipe-discuss mailing list
Ipe-discuss-rGrgPyRx506NN8uzcEdRPYRWq/[email protected]
http://lists.science.uu.nl/mailman/listinfo/ipe-discuss
CGAL_Ipelet_base_v7.h.patch (text/x-patch, 4.4 KB)
--- include/CGAL/CGAL_Ipelet_base_v7.h	
+++ include/CGAL/CGAL_Ipelet_base_v7.h	
@@ -60,7 +60,8 @@
     typedef ipe::Curve  IpeSegmentSubPath;//ipe6 compatibility
     typedef ipe::Matrix IpeMatrix;//ipe6 compatibility
     typedef ipe::Path   IpePath;//ipe6 compatibility
-  
+    //indicates if the selection should be primary or secondary. Exactly one primary selection should exist
+    ipe::TSelect get_selection_type() const { return get_IpePage()->primarySelection()==-1 ? ipe::EPrimarySelected : ipe::ESecondarySelected;}  
     //ipe6 compatibility
     void transform_selected_objects_(const IpeMatrix& tfm) const {
       for (int i=0;i<get_IpePage()->count();++i)
@@ -82,7 +83,7 @@
           //~ grp->push_back( get_IpePage()->object(i-1) );      
           get_IpePage()->remove(i-1);      
         }
-      get_IpePage()->append(ipe::ESecondarySelected,CURRENTLAYER,grp);    
+      get_IpePage()->append(get_selection_type(),CURRENTLAYER,grp);    
     }
     
   
@@ -318,7 +319,7 @@
         shape.appendSubPath(*it);
       if (delete_underlying_polygons)
         delete_selected_objects_();
-      get_IpePage()->append(ipe::ESecondarySelected,CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,shape));    
+      get_IpePage()->append(get_selection_type(),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,shape));    
     }
     
     void 
@@ -372,7 +373,7 @@
           obj_ipe->setPathMode(ipe::EStrokedAndFilled);
           obj_ipe->setFill(ipe::Attribute::BLACK());
         }
-        get_IpePage()->append( (deselect_all?ipe::ENotSelected:ipe::ESecondarySelected),CURRENTLAYER,obj_ipe);
+        get_IpePage()->append( (deselect_all?ipe::ENotSelected:get_selection_type()),CURRENTLAYER,obj_ipe);
         return obj_ipe;
       }
       return NULL;  
@@ -386,14 +387,14 @@
                                 );
       ipe::Shape shape;
       shape.appendSubPath(ellipse);
-      get_IpePage()->append( (deselect_all?ipe::ENotSelected:ipe::EPrimarySelected),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,shape));
+      get_IpePage()->append( (deselect_all?ipe::ENotSelected:get_selection_type()),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,shape));
     }
  
     void
     draw_in_ipe(const Point_2& P,bool deselect_all=false) const 
     {
       ipe::Reference *mark = new ipe::Reference(CURRENTATTRIBUTES,CURRENTATTRIBUTES.iMarkShape, ipe::Vector(CGAL::to_double(P.x()),CGAL::to_double(P.y())));
-      get_IpePage()->append( (deselect_all?ipe::ENotSelected:ipe::ESecondarySelected),CURRENTLAYER,mark);      
+      get_IpePage()->append( (deselect_all?ipe::ENotSelected:get_selection_type()),CURRENTLAYER,mark);      
     }
     
     void 
@@ -402,7 +403,7 @@
       ipe::Segment seg_ipe;
       seg_ipe.iP = ipe::Vector(CGAL::to_double(S.point(0).x()),CGAL::to_double(S.point(0).y()));
       seg_ipe.iQ = ipe::Vector(CGAL::to_double(S.point(1).x()),CGAL::to_double(S.point(1).y()));
-      get_IpePage()->append( (deselect_all?ipe::ENotSelected:ipe::ESecondarySelected),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,ipe::Shape(seg_ipe)));      
+      get_IpePage()->append( (deselect_all?ipe::ENotSelected:get_selection_type()),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,ipe::Shape(seg_ipe)));      
     }
     
     template<class Container>
@@ -431,7 +432,7 @@
                                    ipeS,ipeT);
       ipe::Shape shape;
       shape.appendSubPath(SSP_ipe);
-      get_IpePage()->append( (deselect_all?ipe::ENotSelected:ipe::ESecondarySelected),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,shape));
+      get_IpePage()->append( (deselect_all?ipe::ENotSelected:get_selection_type()),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,shape));
     }
 
 
@@ -448,7 +449,7 @@
       SSP_ipe->setClosed(true);
       ipe::Shape shape;
       shape.appendSubPath(SSP_ipe);
-      get_IpePage()->append( (deselect_all?ipe::ENotSelected:ipe::ESecondarySelected),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,shape));
+      get_IpePage()->append( (deselect_all?ipe::ENotSelected:get_selection_type()),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,shape));
     }
     
     void 
@@ -466,7 +467,7 @@
       SSP_ipe->setClosed(true);
       ipe::Shape shape;
       shape.appendSubPath(SSP_ipe);
-      get_IpePage()->append( (deselect_all?ipe::ENotSelected:ipe::ESecondarySelected),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,shape));
+      get_IpePage()->append( (deselect_all?ipe::ENotSelected:get_selection_type()),CURRENTLAYER,new ipe::Path(CURRENTATTRIBUTES,shape));
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.