Beispiel #1
0
 protected override Infrustructure.Plans.Elements.ElementBaseRectangle CreateElement()
 {
     var element = new ElementRectangleZone();
     var propertiesViewModel = new ZonePropertiesViewModel(element);
     DialogService.ShowModalWindow(propertiesViewModel);
     Helper.SetZone(element);
     return element;
 }
		protected override ElementBaseRectangle CreateElement()
		{
			var element = new ElementRectangleZone();
			var propertiesViewModel = new ZonePropertiesViewModel(element, _zonesViewModel);
			if (!DialogService.ShowModalWindow(propertiesViewModel))
				return null;
			Helper.SetZone(element);
			return element;
		}
		public override ElementBase Clone()
		{
			var elementBase = new ElementRectangleZone();
			Copy(elementBase);
			return elementBase;
		}
		void AddRectangleZone(Plan plan, surfacesSurfaceLayerElementsElement innerElement, Zone zone)
		{
			try
			{
				var elementRectangleZone = new ElementRectangleZone()
				{
					ZoneUID = zone == null ? Guid.Empty : zone.UID,
					Left = Math.Min(Parse(innerElement.rect[0].left), Parse(innerElement.rect[0].right)),
					Top = Math.Min(Parse(innerElement.rect[0].top), Parse(innerElement.rect[0].bottom)),
					Width = Math.Abs(Parse(innerElement.rect[0].right) - Parse(innerElement.rect[0].left)),
					Height = Math.Abs(Parse(innerElement.rect[0].bottom) - Parse(innerElement.rect[0].top))
				};
				plan.ElementRectangleZones.Add(elementRectangleZone);
				if (zone != null)
				{
					if (zone.PlanElementUIDs == null)
						zone.PlanElementUIDs = new List<Guid>();
					zone.PlanElementUIDs.Add(elementRectangleZone.UID);
				}
			}
			catch (Exception e)
			{
				Logger.Error(e, "ConfigurationConverter.AddRectangleZone");
			}
		}
        void AddRectangleZone(Plan plan, surfacesSurfaceLayerElementsElement innerElement, int? zoneNo)
        {
            var elementRectangleZone = new ElementRectangleZone()
            {
                ZoneNo = zoneNo,
                Left = Math.Min(Parse(innerElement.rect[0].left), Parse(innerElement.rect[0].right)),
                Top = Math.Min(Parse(innerElement.rect[0].top), Parse(innerElement.rect[0].bottom)),
                Width = Math.Abs(Parse(innerElement.rect[0].right) - Parse(innerElement.rect[0].left)),
                Height = Math.Abs(Parse(innerElement.rect[0].bottom) - Parse(innerElement.rect[0].top))
            };

            plan.ElementRectangleZones.Add(elementRectangleZone);
        }