public void AddToCanvas(Canvas canvas) { canvas.Children.Add(Rectangle); Canvas.SetLeft(Rectangle, MapObjectMetrics.XOfCanvas); Canvas.SetTop(Rectangle, MapObjectMetrics.YOfCanvas); canvas.Children.Add(MapObjectDoor.GetDoor()); canvas.Children.Add(MapObjectNameTextBlock); if (MapObjectEntity.GetType() == typeof(Building)) { ((Building)MapObjectEntity).AddBuildinLayersButtonsToCanvas(canvas); } }
public MapObject(MapObjectEntity mapObjectEntity, MapObjectMetrics mapObjectMetrics, MapObjectDoor mapObjectDoor) { MapObjectEntity = mapObjectEntity; if (MapObjectEntity.GetType() == typeof(Building)) { ((Building)MapObjectEntity).BuildingLayersButtons.MapObjectMetrics = mapObjectMetrics; } MapObjectMetrics = mapObjectMetrics; MapObjectDoor = mapObjectDoor; MapObjectDoor.MapObjectMetrics = mapObjectMetrics; RectangleInitialization(); if (mapObjectEntity.MapObjectType.TypeOfMapObject == TypeOfMapObject.ROAD) { LineInitialization(); } PositionObjectNameTextBlock(); }