예제 #1
0
		public Group(Group prototype): base(prototype)
		{
			Shapes = new Elements(typeof(Shape),"Shape");
			Lines = new Elements(typeof(Line),"Line");
			mRenderList = new RenderList();
			mMargin = prototype.Margin;

			mCheckBounds = prototype.CheckBounds;
			mDrawExpand = prototype.DrawExpand;
			mExpanded = prototype.Expanded;
			mContractedSize = prototype.ContractedSize;
			mExpandedSize = prototype.ExpandedSize;
		}
예제 #2
0
		//Constructors
		public Group()
		{
			SuspendEvents = true;

			DrawBackground = false;
			DrawShadow = false;
			BorderStyle = DashStyle.Dash;
			ExpandedSize = MaximumSize;
			ContractedSize = Size;
			DrawExpand = true;
			Expanded = true;
			CheckBounds = true;
            
			//Set up objects and event handlers
			Shapes = new Elements(typeof(Shape),"Shape");
			Lines = new Elements(typeof(Line),"Line");
			mMargin = new Margin();
			mRenderList = new RenderList();

			SuspendEvents = false;
		}
예제 #3
0
		public bool Contains(PointF location, Margin margin)
		{
			return new RectangleF(margin.Left, margin.Top, DiagramSize.Width - margin.Right - margin.Left,DiagramSize.Height - margin.Bottom - margin.Top).Contains(location);
		}
예제 #4
0
		public Diagram(Diagram prototype)
		{
			InitializeComponent();
			SetStyle(System.Windows.Forms.ControlStyles.UserPaint, true);
			SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint, true);
			SetStatus(Status.Default);
			
			//Create a new renderer
			SetRender(new Render()); //Sets up current layers reference etc
			ClearDiagram();	
			Margin = new Margin();

			SuspendEvents = true;
			
			mDiagramSize = prototype.DiagramSize;
			mShowToolTips = prototype.ShowTooltips;
			mCheckBounds = prototype.CheckBounds;
			mMargin = prototype.Margin;
			Paged = prototype.Paged;
			WorkspaceColor = prototype.WorkspaceColor;

			SuspendEvents = false;
		}
예제 #5
0
		//Constructor
		public Diagram()
		{
			//Create License
			Component.Instance.GetLicense(typeof(Diagram), this);
			
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();
			SetStyle(System.Windows.Forms.ControlStyles.UserPaint, true);
			SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint, true);
			SetStatus(Status.Default);

			//Create a new renderer
			SetRender(new Render()); //Sets up current layers reference etc
			ClearDiagram();
			Margin = new Margin();
			Animator = new Animator(this);
			
			//Create an initial render and draw onto control surface
			mRender.RenderDiagram(new Rectangle(0,0,this.Width,this.Height));
			DrawDiagram(new Rectangle(0,0,this.Width,this.Height));
		}
예제 #6
0
		private void LoadDiagram(Stream fs, IFormatter formatter)
		{
			Diagram diagram;
			SurrogateSelector selector = new SurrogateSelector();
			DiagramSerialize surrogate = new DiagramSerialize();

			try 
			{
				selector.AddSurrogate(typeof(Diagram),new StreamingContext(StreamingContextStates.All), surrogate);

				//Raise the deserialize event and allow subclasses to add/change the surrogate to their own surrogate
				OnDeserialize(formatter,selector);

				formatter.SurrogateSelector = selector;
				formatter.Binder = Component.Instance.DefaultBinder;
			
				diagram = (Diagram) formatter.Deserialize(fs);
			}
			catch (Exception ex) 
			{
				if (ex.InnerException == null)
				{
					throw ex;
				}
				else
				{
					throw ex.InnerException;
				}
			}
			finally 
			{
				
			}

			surrogate = Serialization.Serialize.GetSurrogate(diagram,selector);
			if (surrogate == null) throw new Exception("A deserialization surrogate could not be found.");

			//Update this object using the surrogate and the diagram
			surrogate.UpdateObjectReferences();

			SuspendEvents = true;
			Suspend();
			
			//Copy settings from deserialized object
			DiagramSize = diagram.DiagramSize;
			Zoom = diagram.Zoom;
			ShowTooltips = diagram.ShowTooltips;
			CheckBounds = diagram.CheckBounds;
			Paged = diagram.Paged;
			WorkspaceColor = diagram.WorkspaceColor;
			
			//Copy all layers across
			Layers.Clear();
			foreach (Layer layer in surrogate.Layers)
			{
				Layers.Add(layer);
			}
			Layers.CurrentLayer = surrogate.Layers.CurrentLayer;

			//Copy shapes and lines accross
			Shapes.Clear();
			foreach (Shape shape in surrogate.Shapes.Values)
			{
				Shapes.Add(shape.Key,shape);
			}

			Lines.Clear();
			foreach (Line line in surrogate.Lines.Values)
			{
				Lines.Add(line.Key,line);
			}

			mNavigate = new Navigation.Navigate(this);
			Route = new Route();
			Route.Container = this;
			Margin = new Margin(); //##margin needs to be serialized/deserialized

			//Raise the deserialize complete event
			OnDeserializeComplete(diagram, formatter, selector);

			Resume();
			SuspendEvents = false;

			Refresh();
		}
예제 #7
0
		//Methods
		public virtual bool Equals(Margin margin)
		{
			return (mTop == margin.Top && mLeft == margin.Left && mRight == margin.Right && mBottom == margin.Bottom);
		}
예제 #8
0
		public virtual bool Contains(PointF location,Margin margin)
		{
			//Offset by group location
			location.X -= Rectangle.X;
			location.Y -= Rectangle.Y;

			return new RectangleF(margin.Left, margin.Top, Size.Width - margin.Right - margin.Left,Size.Height - margin.Bottom - margin.Top).Contains(location);
		}