@@ -739,13 +739,24 @@ public class DrawablesContainer : List<IDrawable>, IDrawable
739739 {
740740 public void Draw ( Geometry . Box box , Graphics graphics , Settings settings , Geometry . Traits traits )
741741 {
742- // TODO: Draw using IDrawable color?
743742 for ( int i = 0 ; i < this . Count ; ++ i )
744743 {
745744 this [ i ] . Draw ( box , graphics , settings , traits ) ;
746745 }
747746 }
748747
748+ // TODO: This overload is defined to allow drawing elements using their specific colors
749+ // Incorporate this into the IDrawable interface?
750+ public void Draw ( Geometry . Box box , Graphics graphics , Settings settings , Geometry . Traits traits , Colors colors )
751+ {
752+ for ( int i = 0 ; i < this . Count ; ++ i )
753+ {
754+ IDrawable drawable = this [ i ] ;
755+ settings . color = DefaultColor ( drawable , colors ) ;
756+ drawable . Draw ( box , graphics , settings , traits ) ;
757+ }
758+ }
759+
749760 public Geometry . Box Aabb ( Geometry . Traits traits , bool calculateEnvelope )
750761 {
751762 Geometry . Box result = null ;
@@ -1211,7 +1222,7 @@ static Color DefaultColor(IDrawable drawable, Colors colors)
12111222 return colors . BoxColor ;
12121223 else if ( drawable is NSphere )
12131224 return colors . NSphereColor ;
1214- else if ( drawable is Segment )
1225+ else if ( drawable is Segment ) // Ray, Line
12151226 return colors . SegmentColor ;
12161227 else if ( drawable is Linestring )
12171228 return colors . LinestringColor ;
@@ -1227,8 +1238,6 @@ static Color DefaultColor(IDrawable drawable, Colors colors)
12271238 return colors . MultiPolygonColor ;
12281239 else if ( drawable is Turn || drawable is TurnsContainer )
12291240 return colors . TurnColor ;
1230- else if ( drawable is DrawablesContainer )
1231- return colors . GeometriesContainerColor ;
12321241 else
12331242 return colors . DrawColor ;
12341243 }
@@ -1254,7 +1263,11 @@ public static bool Draw(Graphics graphics,
12541263 bool fill = ( traits == null ) ;
12551264 if ( drawable . DrawAxes ( ) )
12561265 Drawer . DrawAxes ( graphics , aabb , unit , colors , fill ) ;
1257- drawable . Draw ( aabb , graphics , settings , traits ) ;
1266+ // TODO: This is ugly, it should probably be changed
1267+ if ( drawable is DrawablesContainer )
1268+ ( drawable as DrawablesContainer ) . Draw ( aabb , graphics , settings , traits , colors ) ;
1269+ else
1270+ drawable . Draw ( aabb , graphics , settings , traits ) ;
12581271 }
12591272 return true ;
12601273 }
0 commit comments