void insert_join (Join eqn) {//inserts an join in rep and parse trees LOG_DEBUG1( "O: inserting join Ob" ) Ob j = get_join(eqn); Assert3(!isDepricated(j), "insert_join: bad join"); Ob l = get_lhs(eqn); Assert3(!isDepricated(l), "insert_join: bad lhs"); Ob r = get_rhs(eqn); Assert3(!isDepricated(r), "insert_join: bad rhs"); //update bool properties j(BOOL_PROPERTIES) |= STRUCTURAL & l(BOOL_PROPERTIES) & r(BOOL_PROPERTIES); }
// --------------------------------------------------------------------------- // // ----------- bool bToolGeomWithJoin::get_join(i2dvertex* res){ i2dvertex br,r; double bd=LONG_MAX,d=LONG_MAX; bGenericType* tp; for(long i=1;i<=_gapp->typesMgr()->count();i++){ if(_tp_use.get(i,&tp)==false){ continue; } if(tp==NULL){ continue; } if((get_join(i,&r,&d))&&(d<bd)){ bd=d; br=r; } } if(bd!=LONG_MAX){ *res=br; return(true); } return(false); }
// --------------------------------------------------------------------------- // // ----------- void bToolGeomWithJoin::track_join(){ i2dvertex br; if(get_join(&br)){ set_cur(&br); } }
// --------------------------------------------------------------------------- // // ----------- void bToolCut::clic(CGPoint pt, int count){ i2dvertex br; bGenericType* tp; if(get_use_locs()){// Cas des polygones if(count>1){ if(get_locs()->count()>1){ action(0); } set_use_locs(false); set_use_sel(true); set_obj(NULL); get_locs()->reset(); } if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); } else{ bToolGeomWithJoin::clic(pt,count); } if(get_obj()){ ivertices* vxs; get_clic(&br); get_obj()->getVertices(&vxs); if( ( (ivx2ivs_dist(&br,vxs)>__FUZZY_DIST__) && (!ivx_in_ivs(&br,vxs,false)) ) || ( (get_locs()->count()>1) && (ivx2ivs_dist(&br,vxs)<=__FUZZY_DIST__) ) ){ if(get_locs()->count()>1){ action(0); } set_use_locs(false); set_use_sel(true); set_obj(NULL); get_locs()->reset(); } } return; } if(!get_obj()){ if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); } else{ bToolGeomWithJoin::clic(pt,count); } return; } tp=_gapp->typesMgr()->get(get_obj()->getType()); switch(tp->kind()){ case kBaseKindPolyline: if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); } else{ bToolGeomWithJoin::clic(pt,count); } action(0); break; case kBaseKindPolygon: case kBaseKindRaster: set_use_locs(true); if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); } else{ bToolGeomWithJoin::clic(pt,count); } set_use_sel(false); break; default: if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); } else{ bToolGeomWithJoin::clic(pt,count); } break; } }
// --------------------------------------------------------------------------- // // ----------- void bToolRedraw::clic(CGPoint pt, int count){ i2dvertex br; bGenericType* tp; if(_ec>1){ if(count>1){ if(get_locs()->count()>=1){ action(0); } set_use_locs(false); set_obj(NULL); get_locs()->reset(); _ec=0; set_curs(); } if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); } else{ bToolGeomWithJoin::clic(pt,count); } return; } else if((count>1)&&(_ec==1)){// =Annuler set_use_locs(false); set_obj(NULL); get_locs()->reset(); _ec=0; set_curs(); } if(!get_obj()){ if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); } else{ bToolGeomWithJoin::clic(pt,count); } return; } tp=_gapp->typesMgr()->get(get_obj()->getType()); switch(tp->kind()){ case kBaseKindPolyline: case kBaseKindPolygon: case kBaseKindRaster: if(_ec==0){ set_use_locs(true); if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); } else{ bToolGeomWithJoin::clic(pt,count); } set_use_locs(false); get_clic(&_vxa); _ec++; } else if(_ec==1){ if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); get_clic(&_vxb); if(!eq_ivx2(&_vxa,&_vxb)){ set_clic(&_vxa); set_use_locs(true); _ec++; set_curs(_cdrw); } else{ NSBeep(); } } else{ NSBeep(); } } else{ if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); } else{ bToolGeomWithJoin::clic(pt,count); } _ec++; } break; default: if(get_join(&br)){ bToolGeomWithJoin::clic(br,count); } else{ bToolGeomWithJoin::clic(pt,count); } break; } }