示例#1
0
		private Elements GetSelectedElements(System.Type type)
		{
			Elements elements = new Elements();

			foreach (Shape shape in Shapes.Values)
			{
				if (shape.Selected && (type.IsInstanceOfType(shape) || shape.GetType().IsSubclassOf(type))) elements.Add(shape.Key,shape);
			}

			foreach (Line line in Lines.Values)
			{
				if (line.Selected && (type.IsInstanceOfType(line) || line.GetType().IsSubclassOf(type))) elements.Add(line.Key,line);
			}

			elements.SetModifiable(false);
			return elements;
		}
示例#2
0
		public Line(Line prototype): base(prototype)
		{
			mAllowMove = prototype.AllowMove;
			mLineJoin = prototype.LineJoin;
			mDrawSelected = prototype.DrawSelected;
			mInteraction = prototype.Interaction;
			
			//Set up new origins
			Start = new Origin(prototype.FirstPoint);
			End = new Origin(prototype.LastPoint);

			Start.Marker = prototype.Start.Marker;
			End.Marker = prototype.End.Marker;

			mPoints = (ArrayList) prototype.Points.Clone();

			//Copy ports
			Ports = new Elements(typeof(Port),"Port");
			foreach (Port port in prototype.Ports.Values)
			{
				Port clone = (Port) port.Clone();
				Ports.Add(port.Key,clone);
				
				clone.SuspendValidation();
				clone.Location = port.Location;
				clone.ResumeValidation();
			}

			if (prototype.Animation != null) mAnimation = (Animation) prototype.Animation.Clone();

			DrawPath();
		}
示例#3
0
		//Sets the selected working elements
		private void GetSelectedElements()
		{
			mSelectedElements = new Elements();
			mSelectedShapes = new Elements(typeof(Shape),"Shape");
			mSelectedLines = new Elements(typeof(Line),"Line");

			foreach (Shape shape in Shapes.Values)
			{
				if (shape.Selected)
				{
					mSelectedElements.Add(shape.Key,shape);
					mSelectedShapes.Add(shape.Key,shape);
				}
			}

			foreach (Line line in Lines.Values)
			{
				if (line.Selected) 
				{
					mSelectedElements.Add(line.Key,line);
					mSelectedLines.Add(line.Key,line);
				}
			}

			mSelectedElements.SetModifiable(false);
			mSelectedShapes.SetModifiable(false);
			mSelectedLines.SetModifiable(false);
		}
示例#4
0
		public Shape(Shape prototype): base(prototype)
		{
			mAllowMove = prototype.AllowMove;
			mAllowScale = prototype.AllowScale;
			mAllowRotate = prototype.AllowRotate;
			mDrawSelected = prototype.DrawSelected;
			mDirection = prototype.Direction;
			mInteraction = prototype.Interaction;
			
			mMaximumSize = prototype.MaximumSize;
			mMinimumSize = prototype.MinimumSize;
			mKeepAspect = prototype.KeepAspect;

			//Copy ports
			Ports = new Elements(typeof(Port),"Port");
			foreach (Port port in prototype.Ports.Values)
			{
				Port clone = (Port) port.Clone();
				Ports.Add(port.Key,clone);
				
				clone.SuspendValidation();
				clone.Location = port.Location;
				clone.ResumeValidation();
			}

			if (prototype.Animation != null) mAnimation = (Animation) prototype.Animation.Clone();
		}