+ int iMap;
+ if ( shape2ShapeMaps[0].Extent() == shape2ShapeMaps[1].Extent() )
+ {
+ // choose an assiciation by shortest distance between VERTEXes
+ double dist1 = 0, dist2 = 0;
+ TopTools_DataMapIteratorOfDataMapOfShapeShape ssIt( shape2ShapeMaps[0]._map1to2 );
+ for (; ssIt.More(); ssIt.Next() )
+ {
+ if ( ssIt.Key().ShapeType() != TopAbs_VERTEX ) continue;
+ gp_Pnt pIn = BRep_Tool::Pnt( TopoDS::Vertex( ssIt.Key() ));
+ gp_Pnt pOut1 = BRep_Tool::Pnt( TopoDS::Vertex( ssIt.Value() ));
+ gp_Pnt pOut2 = BRep_Tool::Pnt( TopoDS::Vertex( shape2ShapeMaps[1]( ssIt.Key() )));
+ dist1 += pIn.SquareDistance( pOut1 );
+ dist2 += pIn.SquareDistance( pOut2 );
+ }
+ iMap = ( dist1 < dist2 ) ? 0 : 1;
+ }
+ else
+ {
+ iMap = ( shape2ShapeMaps[0].Extent() > shape2ShapeMaps[1].Extent() ) ? 0 : 1;
+ }
+ ProjectionUtils::TShapeShapeMap& shape2ShapeMap = shape2ShapeMaps[iMap];
+