コード例 #1
0
ファイル: Collections.cs プロジェクト: ChrisMoreton/Test3
		public void Remove(Group g)
		{
			List.Remove(g);
		}
コード例 #2
0
ファイル: Collections.cs プロジェクト: ChrisMoreton/Test3
		public void Add(Group g)
		{
			List.Add(g);
		}
コード例 #3
0
ファイル: Collections.cs プロジェクト: ChrisMoreton/Test3
		public void Insert(int i, Group g)
		{
			List.Insert(i, g);
		}
コード例 #4
0
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		internal void deleteGroup(Group group)
		{
			groups.Remove(group);
			group.onDelete();
			group = null;
		}
コード例 #5
0
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		internal void fireGroupDestroyed(Group group)
		{
			if (GroupDestroyed != null)
				GroupDestroyed(this, new GroupEventArgs(group));
		}
コード例 #6
0
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		/// <summary>
		/// Creates a new hierarchical group.
		/// </summary>
		/// <param name="mainObj">The group master item; the subordinated items will follow the
		/// master one when it is moved around.</param>
		/// <returns>A new Group instance.</returns>
		public Group CreateGroup(ChartObject mainObj)
		{
			if (mainObj == null) return null;

			Group group = new Group(this);
			if (group.setMainObject(mainObj))
			{
				AddGroupCmd cmd= new AddGroupCmd(mainObj, group);
				undoManager.executeCommand(cmd);
				return group;
			}
			else
			{
				group.onDelete();
				group = null;
				return null;
			}
		}
コード例 #7
0
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		/// <summary>
		/// Destroys the specified group; the group items are not deleted.
		/// </summary>
		/// <param name="group">The group that should be destroyed.</param>
		public void DestroyGroup(Group group)
		{
			new RemoveGroupCmd(group.MainObject, group).Execute();
		}
コード例 #8
0
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		/// <summary>
		/// Adds the specified group to the flowchart.
		/// </summary>
		/// <param name="group">A new Group object that should be added to the flowchart.</param>
		public void Add(Group group)
		{
			group.flowChart = this;
			AddGroupCmd cmd = new AddGroupCmd(group.MainObject, group);
			undoManager.executeCommand(cmd);
			setDirty();
		}
コード例 #9
0
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		private ItemsAndGroups copySelection(
			FlowChart doc, bool unconnectedArrows, bool copyGroups)
		{
			if (doc.Selection.Objects.Count == 0)
				return null;

			// determine which items and groups to copy
			ChartObjectCollection items = new ChartObjectCollection();
			GroupCollection groups = new GroupCollection();
			Hashtable indexMap = new Hashtable();
			for (int i = 0; i < doc.Selection.Objects.Count; ++i)
			{
				ChartObject item = doc.Selection.Objects[i];

				// do not copy unconncted arrows if specified
				if (!unconnectedArrows && item is Arrow)
				{
					Arrow arrow = item as Arrow;
					if (!arrow.IsConnected) continue;
				}

				indexMap[item] = items.Count;
				items.Add(item);
				
				if (copyGroups && item.SubordinateGroup != null)
					groups.Add(item.SubordinateGroup);
			}

			// add subordinated group items
			foreach (Group group in groups)
			{
				foreach (ChartObject item in group.AttachedObjects)
				{
					if (!items.Contains(item))
					{
						indexMap[item] = items.Count;
						items.Add(item);
					}
				}
			}

			// copy nodes
			for (int i = 0; i < items.Count; ++i)
			{
				ChartObject item = items[i];

				if (item is Box) items[i] = new Box((Box)item);
				if (item is ControlHost) items[i] = new ControlHost((ControlHost)item);
				if (item is Table) items[i] = new Table((Table)item);
			}

			// copy arrows, linking them to node clones
			for (int i = 0; i <  items.Count; ++i)
			{
				if (items[i] is Arrow)
				{
					Arrow arrow = items[i] as Arrow;

					int srcIndex = indexMap.Contains(arrow.Origin) ?
						(int)indexMap[arrow.Origin] : -1;
					int dstIndex = indexMap.Contains(arrow.Destination) ?
						(int)indexMap[arrow.Destination] : -1;

					items[i] = new Arrow(arrow,
						srcIndex == -1 ? Dummy : items[srcIndex] as Node,
						dstIndex == -1 ? Dummy : items[dstIndex] as Node);
				}
			}

			// copy groups
			for (int i = 0; i < groups.Count; ++i)
			{
				Group group = new Group(groups[i]);
				groups[i] = group;
				group.setMainObject(items[(int)indexMap[group.MainObject]]);

				foreach (Attachment atc in group.Attachments)
				{
					atc.node = items[(int)indexMap[atc.node]] as Node;
					atc.node.putInGroup(group);
				}
				group.updateObjCol();
			}

			return new ItemsAndGroups(items, groups);
		}
コード例 #10
0
ファイル: Events.cs プロジェクト: ChrisMoreton/Test3
		public GroupImportedArgs(Group group)
		{
			this.group = group;
		}
コード例 #11
0
ファイル: VisioImporter.cs プロジェクト: ChrisMoreton/Test3
		/// <summary>
		/// Processing Visio shape converting it into Flowchart.NET node
		/// </summary>
		/// <param name="shape">Visio shape's XML node</param>
		/// <param name="ShapeType">String value of the shape type</param>
		/// <param name="group">Reference to parent group ( if any exists) </param>
		/// <returns>Returns [true] if successfull [false] otherwise</returns>
		private bool GetShapeRef(XmlNode shape, string ShapeType,MindFusion.FlowChartX.Group group)
		{
			string sShapeName, sUID = "", sType = "",  sNameU= "", sPath="", sTemp = "",
				sStepX = "", sStepY = "";

			long lShapeType = 0, lX = 0, lY =0, lWidth = 0,
				lHeight = 0, lPinY = 0, lPinX = 0, lLineWith = 0,lCount = 1, lPtX = 0,  lPtY = 0 , lStepX = 0, lStepY = 0, lStartX =0 ,
				lStartY = 0,lEndX = 0, lEndY = 0, lBeginX = 0, lBeginY = 0, lBoxX = 0, lBoxY = 0,
				lTemp = 0, lAdjustX = 0, lAdjustY = 0;

			double fAngle2 = 0;
			XmlNode node_temp = null;
			XmlNode xform1d_node = null;
			bool DontHideGroup = false;

			// Incrementing shape's count
			lShapesCount++;
			sUID = shape.Attributes["ID"].Value.ToString();
			sType = shape.Attributes["Type"].Value.ToString();
			sType = sType.ToLower();

			// Getting 'XForm' node root
			XmlNode xform_node = shape.SelectSingleNode("vdx:XForm", ns);
			
			if ( xform_node == null)
				return false;

			
			
			// Getting Master shape's ID if any exist
			sMasterID = "";
			if ( shape.Attributes["Master"] == null )
			{
				if ( shape.Attributes["MasterShape"] != null )
				{
					sMasterID = shape.Attributes["MasterShape"].Value.ToString();
				}
			}
			else
				sMasterID = shape.Attributes["Master"].Value.ToString();

			// Getting shape's 'NameU' tag if any exist
			sNameU = "";
			if ( shape.Attributes["NameU"] != null )
				sNameU = shape.Attributes["NameU"].Value.ToString();
			sShapeName = sNameU;
			sNameU = sNameU.Trim();
			sNameU = sNameU.ToLower();
			
			if ( sNameU == "" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_NO_NAMEU;
			}

			if (( sNameU == "") && (sMasterID!=""))
			{
				sPath = String.Format("vdx:Master[@ID='{0}']",sMasterID);
				sNameU = GetShapeAttr(sPath,"NameU", mastersRoot);
				sShapeName = sNameU;
			}

			if ( sNameU == null )
				sNameU = "";
				
			sNameU = sNameU.Trim();
			sNameU = sNameU.ToLower();
			
			// Shape is GROUP
#if _POST_FIX_2_1
			if (( sType.IndexOf("group")>=0 ) && ( sNameU.IndexOf("connector")<0))
#else
			if ( sType.IndexOf("group")>=0 )
#endif
			{
				lShapeType |= (long) ShapeTypeEnum.ST_GROUP;
			}

			// Shape is 'arrow - like'
			if (( sNameU.IndexOf("connector") >= 0 ) || ( sNameU.IndexOf("link") >= 0 ) || ( sNameU.IndexOf("generalization") >= 0 ) ||
				( sNameU.IndexOf("association") >= 0 ) || ( sNameU.IndexOf("composition")>=0) ||  ( sNameU == "relationship") ||
				( sNameU.IndexOf("parent to category") >= 0 ) || ( sNameU.IndexOf("categorytochild ") >= 0 ) || (sNameU.IndexOf("object flow")>=0) ||
				(sNameU.IndexOf("control flow")>=0) || (sNameU.IndexOf("2-element constraint")>=0) || (sNameU.IndexOf("or constraint")>=0))
				// (sNameU.IndexOf("shared navigable")>=0))
			{
				lShapeType |= (long) ShapeTypeEnum.ST_CONNECTOR;

			}
			else 
			{
				xform1d_node = shape.SelectSingleNode("vdx:XForm1D", ns);
				if ( xform1d_node != null)
				{
					//return true;
				//	??? REMOVED ??? lShapeType |= (long) ShapeTypeEnum.ST_CONNECTOR;
				}
			}

			// Shape is 'entity - like'

			if ( ( sNameU == "entity 1" ) || ( sNameU.IndexOf("entity." )>=0) || ( sNameU == "entity 2" ) || ( sNameU == "entity" ) || ( sNameU =="view"))
			{
				lShapeType |= (long) ShapeTypeEnum.ST_ENTITY;
			}
		

			// Shape  is 'entity2 - like'
			if ( sNameU == "entity 2" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_ENTITY2;
			}

			// Shape  is part of 'entity - like' group
			if ( ShapeType == "entity" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_PART_OF_ENTITY;
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;
			}

			// Shape  is part of 'entity2 - like' group
			if ( ShapeType == "entity 2" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_PART_OF_ENTITY;
				lShapeType |= (long) ShapeTypeEnum.ST_PART_OF_ENTITY2;
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;
			}

			// Shape  is part of 'arrow - like' group
			if ( ShapeType == "arrow" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_PART_OF_ARROW;
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;
			}
			
			if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_PART_OF_ENTITY) == ShapeTypeEnum.ST_PART_OF_ENTITY)
			{
				lShapeType |= (long) ShapeTypeEnum.ST_OVAL_PROCESS;
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;
			}

			if ( sNameU == "parameters" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_HIDDEN;
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;
			}

			if (( lShapeType == (long) ShapeTypeEnum.ST_NONE ) || ( lShapeType == (long) ShapeTypeEnum.ST_NO_NAMEU))
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;

			// Getting shape's dimensions and converting it to 'Pixels'
			lWidth = Measure2Pix(xform_node, "Width");
			lHeight = Measure2Pix(xform_node, "Height");
			lX = Measure2Pix(xform_node, "PinX");
			lY = Measure2Pix(xform_node, "PinY");
			lPinX = Measure2Pix(xform_node, "LocPinX");
			lPinY = Measure2Pix(xform_node, "LocPinY");
			
			if ((( lWidth == 0 ) || ( lHeight == 0 )) && 
				(((ShapeTypeEnum)lShapeType & ShapeTypeEnum.ST_SHAPE) == ShapeTypeEnum.ST_SHAPE) && 
				(((ShapeTypeEnum)lShapeType & ShapeTypeEnum.ST_CONNECTOR)!=ShapeTypeEnum.ST_CONNECTOR))
			{
				return false;
			}

			if ( sNameU == "separator")
			{
				return false;
			}	

		
			// Getting shape's styles IDs
#if _POST_FIX_2_1
			sLineStyle = GetStyle2(shape, "LineStyle", "vdx:Line/vdx:LineColor");
			sTextStyle = GetStyle2(shape, "TextStyle", "vdx:Char/vdx:Color");
			sFillStyle = GetStyle2(shape, "FillStyle", "vdx:Fill/vdx:FillForegnd");
#else
			sLineStyle = GetStyle(shape, "LineStyle", ref sLineStyle2);
			sTextStyle = GetStyle(shape, "TextStyle", ref sTextStyle2);
			sFillStyle = GetStyle(shape, "FillStyle", ref sFillStyle2);
#endif

			// Getting colors
			crLineColor = Color.Empty;
			crLineColor = GetColor(shape,sLineStyle,"vdx:Line/vdx:LineColor",null,null,sLineStyle2);

			crFillColor = Color.Empty;
			crFillColor = GetColor(shape,sFillStyle,"vdx:Fill/vdx:FillForegnd","vdx:Fill/vdx:FillForegndTrans",null,sFillStyle2);

			crFillColor2 = Color.Empty;
			crFillColor2 = GetColor(shape,sFillStyle,"vdx:Fill/vdx:FillBkgnd",null,null,sFillStyle2);

			crTextColor = Color.Empty;
			crTextColor = GetColor(shape,sTextStyle,"vdx:Char/vdx:Color",null,null,sTextStyle2);

			// Getting fill patterns
			sFillPattern = "";
			sFillPattern = GetShapeAttr("vdx:Fill/vdx:FillPattern","", shape);
			if ( sFillPattern == null)
			{
				sFillPattern = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Fill/vdx:FillPattern", sFillStyle),"",stylesRoot);
				
			}

			sTemp = GetShapeAttr("vdx:Line/vdx:LineWeight","",shape);
			if ( sTemp == null)
			{
				sTemp = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:LineWeight", sLineStyle),"",stylesRoot);
				
			}

			// Getting line width
			if ( sTemp!=null )
				lLineWith = (long) this.Unit2Pix(sDL,sDL,sTemp);
			else
				lLineWith = 0;
			
			// Getting rotaton angle
			string sAngle = "0", sAngleUnit = "";
			sAngle = GetShapeAttr("vdx:Angle", "", xform_node);
			sAngleUnit = GetShapeAttr("vdx:Angle", "Unit", xform_node);

			fAngle2 = Angle2Deg(sAngleUnit, sAngle);
			
			/*
			if (( sAngle != "0") && ( sAngle!=null))
			{
				sAngle = sAngle.Replace(".",sSeparator);
				fAngle = Convert.ToDouble(sAngle);

				if ( fAngle!=0 )
				{
					fAngle2 = (fAngle/Math.PI)*180;
					if ( fAngle2>0 )
						fAngle2 = 360 - Math.Abs(fAngle2);
					else
						fAngle2 = Math.Abs(fAngle2);

					
				}


			}
			else
			{
				lAngle = 0;
			}

			*/

			sPenStyle = "";
			sPenStyle =  GetShapeAttr("vdx:Line/vdx:LinePattern","", shape);
			if ( sPenStyle == null )
			{
				sPenStyle =  GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:LinePattern", sLineStyle),"", stylesRoot);
			}

			if ((((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_SHAPE ) ==  ShapeTypeEnum.ST_SHAPE)||
				(((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_GROUP ) == ShapeTypeEnum.ST_GROUP)||
				(((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_PART_OF_ARROW ) == ShapeTypeEnum.ST_PART_OF_ARROW))
			{
				if (group != null)			
				{
					// Getting coordinates of the upper left corner of the group
					lBoxX = lOffsetX + lGroupX - lGroupPinX;
					lBoxY = lOffsetY + lBasedY -  ( lGroupY + lGroupPinY );

					// Getting coordinates of the grouped shape
					if (( (ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY ) == ShapeTypeEnum.ST_ENTITY )
						lPinY = 0;

					lBoxX = lBoxX + lX - lPinX;

			
					// Aplying coordinates adustment is shape is part of 'entity-like' group
					if ((((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY )!=ShapeTypeEnum.ST_ENTITY ) && 
						(((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_PART_OF_ENTITY ) == ShapeTypeEnum.ST_PART_OF_ENTITY) && 
						(((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_NO_NAMEU)== ShapeTypeEnum.ST_NO_NAMEU))
					{

						if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_PART_OF_ENTITY2 ) == ShapeTypeEnum.ST_PART_OF_ENTITY2)
							lBoxY = lBoxY + lGroupPinY*2 - lY;

					}
					else
					{
						lBoxY = lBoxY + lGroupPinY*2 - lY - lPinY ;
					}
		

				}
				else // If shape is NOT a part of group
				{


					lBoxX = lOffsetX + lX - lPinX;
					lBoxY = lOffsetY + lBasedY -  ( lY + lPinY );

				}
			
				if  (( bImportEntitiesAsTables ) && ( (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY ) == ShapeTypeEnum.ST_ENTITY) ))
				{
					// If 'entity - like' shape and 'ImportEnitiesAsTables' mode ON
					// then creating group & table instead of group's content

					oTable = pChart.CreateTable( lBoxX  , lBoxY ,lWidth,lHeight);
					if ( oTable == null )
						return false;

					int lRowCount = 0, lCol = 0, lRow = 0;
					bool IsCaption = true;

					XmlNodeList entity_items = shape.SelectNodes("vdx:Shapes/vdx:Shape",ns);
					foreach ( XmlNode entity_node in entity_items )
					{
						if ( entity_node == null)
							continue;
							
						if ( IsCaption )
						{
							sTemp = GetShapeAttr("vdx:Text", "", entity_node);

							if ( sTemp!=null )
								oTable.Caption = sTemp;

							sTemp = GetShapeAttr("vdx:Fill/vdx:FillForegnd", "", entity_node);
							crFillColor = GetColor(entity_node,"","vdx:Fill/vdx:FillForegnd", null, sTemp, null);
							IsCaption = false;
						}
						else
						{
							// Processing Flowchart Table object 
							sTemp = GetShapeAttr("vdx:User[@NameU='LineCount']/vdx:Value", "", entity_node );
							if ( sTemp!=null )
							{
								lRowCount = Convert.ToInt16(sTemp);
								oTable.RowCount = lRowCount;

							}

							if ( lRowCount == 0 )
								lRowCount = 1;

							oTable.RowHeight = lHeight /( lRowCount);
							oTable.CaptionHeight = lHeight /( lRowCount );
							oTable.RedimTable(2, lRowCount );
							XmlNodeList table_list = null;
							table_list = entity_node.SelectNodes("vdx:Text/text()", ns);

							foreach ( XmlNode text_node in table_list )
							{
								// Parsing text using '\n' as separator
								sTemp = text_node.InnerText.ToString();
								sTemp = sTemp.Trim();
								string [] split = sTemp.Split(new Char [] {'\n'});
								foreach ( string text_piece in split )
								{
									if (text_piece!=null)
									{
										if ( oTable.RowCount <= lRow )
											oTable.RowCount++;
												
										oTable[lCol,lRow].Text = text_piece;
									}
											
									lRow++;
								}

							
							
								
								lRow--;
								lRow++;
							
								if (( lRow == 1 ) && (lCol == 0))
								{
									lCol = 1;
									lRow = 0;
								}
							}
								

						}
							
					}

					// Applying table parameters
					//oTable.CaptionColor  = crFillColor;
					oTable.Brush =  new MindFusion.FlowChartX.SolidBrush(Color.White);
					oTable.FillColor = Color.White;
					oTable.CellFrameStyle = CellFrameStyle.Simple;
					oTable.Tag =  sPageID + "_" + sUID;
		
					return true;
				}
				else
					oBox = pChart.CreateBox( lBoxX  , lBoxY ,lWidth,lHeight);
			
				if ( oBox.Equals(null) )
					return false;
			
				oBox.Tag = sPageID + "_" + sUID;

				Trace.WriteLine(String.Format("Box: {0}",sUID));

				if ( sNameU == "" )
					sTemp = sType;
				else
				{
					sTemp = sNameU;
				}

				ShapeTemplate templ1 = 	null;

				if ( ((ShapeTypeEnum)lShapeType & ShapeTypeEnum.ST_PART_OF_ENTITY) == ShapeTypeEnum.ST_PART_OF_ENTITY )
					templ1 = VisioShape2PredefinedShape("Process", ref oBox, ref DontHideGroup, ref crFillColor);
				else
					templ1 = VisioShape2PredefinedShape(sTemp, ref oBox, ref DontHideGroup, ref crFillColor);
		
				if ( templ1 == null )
					return false;

				oBox.Style = BoxStyle.Shape;
				oBox.Shape = templ1;
			
				if ( lHeight == 0 )
				{
					// Getting shape's begin & end coordinates
					lBeginX = Measure2Pix(xform1d_node, "BeginX");
					lBeginY = Measure2Pix(xform1d_node, "BeginY");
					lEndX = Measure2Pix(xform1d_node, "EndX");
					lEndY = Measure2Pix(xform1d_node, "EndY");
				
			
					if ( lEndX != lBeginX)
						lHeight = System.Math.Abs(lEndX - lBeginX);
					else if ( lEndY != lBeginY)
						lHeight = System.Math.Abs(lEndY - lBeginY);
					else
						lHeight = 0;


				}

				/*
				 * 
				 * 
				 * ROTATION
				// If shape has some rotattion then correct Width & Heigh
				if ((lAngle == 90) || ( lAngle == 270))
				{
					long lH =lHeight, lW = lWidth, lDx = Math.Abs(lW-lH);
					lHeight = lW;
					lWidth = lH;
					lBoxX+= lDx/2;
					lBoxY-= lDx/2;
				}
				*/

				// Processing controls & bitmaps

				if ( sType.IndexOf("foreign") >= 0 )
					ProcessForeign(shape);
				// Applying shape's colors, pens etc.

				if ( sFillPattern == "" )
					sFillPattern = "0";
			
				
				if ( System.Convert.ToInt16(sFillPattern) > 1 )
					oBox.Brush = new MindFusion.FlowChartX.LinearGradientBrush(crFillColor, crFillColor2, 90);
				else
					oBox.Brush = new MindFusion.FlowChartX.SolidBrush(crFillColor);
				
				oBox.Pen = new MindFusion.FlowChartX.Pen(crLineColor,lLineWith);

				/*
				 * 
				 * ROTATION
				if ( lAngle!=0 )
					oBox.ShapeOrientation = lAngle;

				*/

				if ( fAngle2!=0)
				{
					oBox.RotateContents = true;
					oBox.RotationAngle = (float) fAngle2;
				}

#if _POST_FIX_2_1
				if (group != null)
				{
					oBox.RotateContents = (group.MainObject as Box).RotateContents;
					oBox.RotationAngle = (group.MainObject as Box).RotationAngle;

				}
#endif

				// set the shape's text
				Font ff = GetFont(shape);
				if ( ff == null )
					oBox.Font = (Font)pChart.Font.Clone();
				else
					oBox.Font = ff;
				sTemp = GetShapeText(shape, oBox);
				if (sTemp != null)
				{
					oBox.PolyTextLayout = true;
					oBox.EnableStyledText = true;
						oBox.Text = sTemp;
					oBox.TextColor = crTextColor;
				}

				if (group!=null)			
				{
					if ( ((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_PART_OF_ARROW ) == ShapeTypeEnum.ST_PART_OF_ARROW)
						//if ( lShapeType & ST_PART_OF_ARROW)
					{
						group.AttachToArrowPoint(oBox,1);
						oBox.Transparent = true;
					}
					else
					{
						group.AttachToCorner(oBox,0);
					}

					oBox.Locked = true;
				}

				if ( sPenStyle!=null )
					oBox.Pen.DashStyle = String2DashStyle(sPenStyle);

				// Raising 'BoxImported' event
				OnBoxImported(oBox, sShapeName, "");
			}
				// If the shape is connector then creating the arrow
			else if ( ((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_CONNECTOR ) == ShapeTypeEnum.ST_CONNECTOR)
			{

				if ( connectRoot == null )
					return false;

				sPath = String.Format("vdx:Connect[@FromSheet='{0}']", sUID);
				XmlNodeList connected_list = connectRoot.SelectNodes(sPath, ns);
					 
				if  (connected_list == null)
					return false;
					 
					

				lTemp = 0;
				string sFrom = "", sTo = "";
				foreach ( XmlNode EachConnection in connected_list)
				{
					if ( EachConnection == null )
						break;
 					
					if ( EachConnection.Attributes["ToSheet"]!=null)
						if ( lTemp == 0 )
							sFrom = EachConnection.Attributes["ToSheet"].Value.ToString();
						else
							sTo = EachConnection.Attributes["ToSheet"].Value.ToString();

					if ( lTemp>0 )
						break;

					lTemp++;

				}
			
				Trace.WriteLine(String.Format("Arrow: {0} - {1}",sFrom,sTo));
				oArrow = CreateFcxLink(sPageID + "_" + sFrom, sPageID + "_" + sTo);
				if ( oArrow == null )
					return false;

				
				// Setting Arrow's ID
				oArrow.Tag = sPageID + "_" + sUID;

				xform1d_node = shape.SelectSingleNode("vdx:XForm1D", ns);
				if ( xform1d_node == null)
					return false;

				// Getting arrow's begin & end coordinates
				lBeginX = Measure2Pix(xform1d_node, "BeginX");
				lBeginY = Measure2Pix(xform1d_node, "BeginY");
				lEndX = Measure2Pix(xform1d_node, "EndX");
				lEndY = Measure2Pix(xform1d_node, "EndY");
				
				// Detecting arrow style
				ArrowStyle stArrow = ArrowStyle.Cascading;

				sTemp = GetShapeAttr("vdx:Layout/vdx:ConLineRouteExt", "", shape);
				if ( sTemp == "2")
					stArrow = ArrowStyle.Bezier;
				else if ( sTemp == "1")
					stArrow = ArrowStyle.Polyline;

				// If arrow is 'line curved' then set 'asBezier' type
				if ( sNameU == "line-curve connector" )
					stArrow = ArrowStyle.Bezier;


			
				// Counting segments arrow consists in
				XmlNodeList segments_list = shape.SelectNodes("vdx:Geom/vdx:LineTo", ns);
				lTemp = segments_list.Count;
				
				if (( stArrow  == ArrowStyle.Cascading) || ( stArrow  == ArrowStyle.Polyline))
				{
					if (lTemp>1)
						stArrow = ArrowStyle.Cascading;
					else
					{
						stArrow = ArrowStyle.Polyline;
					
						
					}
				}

				//Setting arrow style
				oArrow.Style = stArrow;


				if (stArrow == ArrowStyle.Cascading)
				{
					// If the arrow has more than one segment than
					// setting 'asPerpendicular' style for arrow

					oArrow.SegmentCount = (short) lTemp;

					// Setting coordinates of the arrow's origin
					lStartX = lOffsetX + lBeginX ; 
					lStartY = lOffsetY + lBasedY -  ( lBeginY  );
					oArrow.ControlPoints[0]= new PointF(lStartX, lStartX);
					lPtX = lStartX;
					lPtY = lStartY;
					Trace.WriteLine(String.Format("Arrow {0}\tPt:{1}\tX:{2}\tY:{3}",sUID,0,lPtX, lPtY));
                  

					// TODO: If source shape ( pBoxFrom) is non-symmetric ( triangle, pentagon, etc )
					//       arrow base's coordinates need to be adjusted to be source shape's part
					//		 such as follows:
					//		 pArrow->CtrlPtX[0] = ????;
					//		 pArrow->CtrlPtY[0] = ????;

					// Getting arrow segments 'one-by-one' using 'LineTo' XML nodes
					foreach ( XmlNode segment in segments_list )
					{
						if ( segment == null )
							continue;

						// Getting X-coordinate
						node_temp = segment.SelectSingleNode("vdx:X", ns);

						if ( node_temp == null )
						{
							oArrow.Style = ArrowStyle.Polyline;
							break;
						}

						sStepX = node_temp.InnerText;
						lStepX = (long) Unit2Pix(sDL, sDL, sStepX);
						lPtX = lStartX + lStepX;


						// Getting Y-coordinate
						node_temp = segment.SelectSingleNode("vdx:Y", ns);

						if ( node_temp == null )
						{
							oArrow.Style = ArrowStyle.Polyline;
							break;
						}


						sStepY = node_temp.InnerText;
						lStepY = (long) Unit2Pix(sDL, sDL, sStepY);
						lPtY = lStartY - lStepY;

						// Setting new segment for FloChartX arrow
						if ( lCount <= lTemp)
						{
							oArrow.ControlPoints[(int) lCount]= new PointF(lPtX, lPtY);
							Trace.WriteLine(String.Format("Arrow {0}\tPt:{1}\tX:{2}\tY:{3}",sUID,lCount,lPtX, lPtY));
						}
					
						lCount++;
					}
			
			

				}
				else
				{
					// Setting coordinates of the arrow's origin & destination

						
					lAdjustX = 0;
					lAdjustY = 0;
					if ( stArrow == ArrowStyle.Bezier )
					{
						// If curved shape has control points then reflecting adustments
				
						oArrow.SegmentCount = 1;

						if ( sNameU == "line-curve connector" )
						{
				
							node_temp = shape.SelectSingleNode("vdx:Control/vdx:X", ns);
							if ( node_temp != null )
							{
								sTemp = node_temp.InnerText;
								lAdjustX = (long) Unit2Pix(sDL, sDL,sTemp);

							}

							node_temp = shape.SelectSingleNode("vdx:Control/vdx:Y", ns);
							if ( node_temp != null )
							{
								sTemp = node_temp.InnerText;
								lAdjustY = (long) Unit2Pix(sDL, sDL,sTemp);

							}
					
						}

						PointF cpt = oArrow.ControlPoints[0];
						oArrow.ControlPoints[1]= new PointF(cpt.X + lAdjustX , cpt.Y -lAdjustY/2 );
						oArrow.ControlPoints[2]= new PointF(cpt.X + lAdjustX , cpt.Y -lAdjustY/2 );
						oArrow.ControlPoints[3]= new PointF(lOffsetX + lEndX , lOffsetY + lBasedY -  ( lEndY  ));

					}
					else
					{
						oArrow.SegmentCount = 1;
					}
				
				}
				// Setting Begin/End point of the arrow
				oArrow.ControlPoints[0]= new PointF(lOffsetX + lBeginX, lOffsetY + lBasedY -  ( lBeginY  ));	
				oArrow.ControlPoints[oArrow.SegmentCount]= new PointF(lOffsetX + lEndX, lOffsetY + lBasedY -  ( lEndY  ));

				// Updating arrow
				oArrow.UpdateFromPoints();

				// Settiing ArrowBase property
				sTemp = null;
				
				sTemp = GetShapeAttr("vdx:Line/vdx:BeginArrow","",shape);
				if (( sTemp == null ) && ( sLineStyle!=null))
				{
					sTemp = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:BeginArrow",sLineStyle),
						"",stylesRoot);
				}

				if ( sTemp!=null )
				{
					oArrow.ArrowBase = String2ArrowType( sTemp, ref crLineColor);
				}


				// Settiing ArrowBaseSize property
				sTemp = null;
				
				sTemp = GetShapeAttr("vdx:Line/vdx:BeginArrowSize","",shape);
				if (( sTemp == null ) && ( sLineStyle!=null))
				{
					sTemp = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:BeginArrowSize",sLineStyle),
						"",stylesRoot);
				}

				if ( sTemp!=null )
				{
					oArrow.ArrowBaseSize = System.Convert.ToInt16(sTemp) * 5;
				}

				// Setting ArrowHead
				sTemp = GetShapeAttr("vdx:Line/vdx:EndArrow","",shape);
				if (( sTemp == null ) && ( sLineStyle!=null))
				{
					sTemp = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:EndArrow",sLineStyle),
						"",stylesRoot);
				}

				if ( sTemp!=null )
				{
					oArrow.ArrowHead = String2ArrowType( sTemp, ref crLineColor);
				}


				// Settiing ArrowHeadSize property
				sTemp = null;
				
				sTemp = GetShapeAttr("vdx:Line/vdx:EndArrowSize","",shape);
				if (( sTemp == null ) && ( sLineStyle!=null))
				{
					sTemp = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:EndArrowSize",sLineStyle),
						"",stylesRoot);
				}

				if ( sTemp!=null )
				{
					oArrow.ArrowHeadSize = System.Convert.ToInt16(sTemp) * 5;
				}


			
				// [???] Setting arrow's color
				oArrow.Pen = new MindFusion.FlowChartX.Pen(crLineColor,lLineWith);
				oArrow.HeadPen = oArrow.Pen;
				oArrow.Brush = new MindFusion.FlowChartX.SolidBrush(crFillColor);

				if ( sPenStyle!=null )
					oArrow.Pen.DashStyle = String2DashStyle(sPenStyle);

				// Performing post-processing for special arrow types
				if ( sNameU	== "composition")
				{
					oArrow.ArrowBase = ArrowHead.Rhombus;
					oArrow.ArrowHead =	ArrowHead.None;
				}
				else if	( sNameU ==	"generalization")
				{
					oArrow.ArrowBase =	ArrowHead.Triangle;
					oArrow.ArrowHead = ArrowHead.None;
					oArrow.FillColor =  Color.FromArgb(255,255,255);
				}
				else if ( sNameU == "object flow")
				{
					oArrow.ArrowBase =	ArrowHead.None;
					oArrow.ArrowHead = ArrowHead.Arrow;
					oArrow.Pen.DashStyle = DashStyle.Dash;
				}
				else if ( sNameU == "control flow")
				{
					oArrow.ArrowBase = ArrowHead.None;
					oArrow.ArrowHead = ArrowHead.Arrow;
					oArrow.Pen.DashStyle = DashStyle.Solid;
				}
				else if ( sNameU.IndexOf("association")>=0)
				{
					oArrow.ArrowBase = ArrowHead.None;
					oArrow.ArrowHead = ArrowHead.Arrow;
					//oArrow.FillColor =  Color.FromArgb(255,255,255);
					oArrow.Pen.DashStyle = DashStyle.Solid;
				}
				else if ( sNameU == "2-element constraint")
				{
					oArrow.ArrowBase =	ArrowHead.Arrow;
					oArrow.ArrowHead = ArrowHead.None;
					//oArrow.FillColor =  Color.FromArgb(255,255,255);
					oArrow.Pen.DashStyle = DashStyle.Dot;
				}
				else if ( sNameU == "or constraint")
				{
					oArrow.ArrowBase =	ArrowHead.Arrow;
					oArrow.ArrowHead = ArrowHead.None;
					//oArrow.FillColor =  Color.FromArgb(255,255,255);
					oArrow.Pen.DashStyle = DashStyle.Dot;
				}
				

				// Setting arrow's text

				sTemp = GetShapeText(shape, oArrow);
				if (sTemp != null)
				{
					Font ff = GetFont(shape);
					if ( ff == null )
						oArrow.Font = pChart.Font;
					else
						oArrow.Font = ff;

					oArrow.Text = sTemp;
					oArrow.TextColor = crTextColor;

				}
				fnShape = null;
				fnShape = GetFont(shape);

				// Raising 'ArrowImported' event
				OnArrowImported(oArrow, sShapeName);
			}
			// if the shape is GROUP
			if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_GROUP ) == ShapeTypeEnum.ST_GROUP)
			{
				if ((((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY ) != ShapeTypeEnum.ST_ENTITY) &&
					(((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_OVAL_PROCESS ) != ShapeTypeEnum.ST_OVAL_PROCESS))																					 
				{
					if (!DontHideGroup)
					{
						oBox.Transparent = true;
						oBox.FillColor = Color.FromArgb(255,255,255);
					}
					
				}
		
				oGroup = null;

				if ( oArrow != null )
					oGroup = pChart.CreateGroup(oArrow);
				else
					oGroup = pChart.CreateGroup(oBox);
				// Saving group's measures for future use
				lGroupY = lY;
				lGroupX = lX;
				lGroupPinY = lPinY;
				lGroupPinX = lPinX;

				// Scanning for group members and creating it using recursive call
			
				XmlNodeList grshape_list = null;
				grshape_list = shape.SelectNodes("vdx:Shapes/vdx:Shape", ns);
				foreach ( XmlNode grshape in grshape_list)
				{
					sTemp = String.Format("{0}",ShapeType);

					if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY ) == ShapeTypeEnum.ST_ENTITY)
						//   if ( lShapeType & ST_ENTITY )
						sTemp = "entity";

					if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY2 ) == ShapeTypeEnum.ST_ENTITY2)
						//if ( lShapeType & ST_ENTITY2 )
						sTemp = "entity 2";

					if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_CONNECTOR ) == ShapeTypeEnum.ST_CONNECTOR)
						//   if ( lShapeType & ST_CONNECTOR )
						sTemp = "arrow";
					GetShapeRef(grshape,sTemp,oGroup);
				}

#if _POST_FIX_2_1
				if (DontHideGroup)
				{
					foreach ( Box grBox in oGroup.AttachedObjects )
					{
						grBox.Transparent = true;
					}
				}
#endif

				// Raising 'GroupImported' event
				OnGroupImported(oGroup);
			}

			oBox = null;
			oArrow = null;

			return true;
		}
コード例 #12
0
ファイル: Group.cs プロジェクト: ChrisMoreton/Test3
		public Group(Group prototype)
		{
			flowChart = prototype.flowChart;
			mainObj = prototype.mainObj;
			cycleProtect = false;
			attachments = (ArrayList)prototype.attachments.Clone();
			for (int i = 0; i < attachments.Count; ++i)
				attachments[i] = (attachments[i] as Attachment).Clone();

			autoDeleteItems = prototype.autoDeleteItems;
			tag = prototype.tag;
			visible = prototype.visible;

			attachedObjects = new ChartObjectCollection();
			updateObjCol();
			arrowsToMove = new ArrowCollection();

			expandable = prototype.expandable;
			followMasterRotation = prototype.followMasterRotation;
		}
コード例 #13
0
ファイル: ChartObject.cs プロジェクト: ChrisMoreton/Test3
		// ************* group to which this object is attached ************

		internal void putInGroup(Group group)
		{
			masterGroup = group;
		}
コード例 #14
0
ファイル: ChartObject.cs プロジェクト: ChrisMoreton/Test3
		// ************ group of objects attached to this one ************

		internal bool setGroup(Group group)
		{
			if (subordinateGroup == group) return true;
			if (group != null && subordinateGroup != null) return false;

			subordinateGroup = group;
			return true;
		}
コード例 #15
0
ファイル: ChartObject.cs プロジェクト: ChrisMoreton/Test3
		public virtual void setReference(int refId, IPersists obj)
		{
			switch (refId)
			{
			case 100:
				subordinateGroup = (Group)obj;
				break;
			case 101:
				masterGroup = (Group)obj;
				break;
			}
		}
コード例 #16
0
ファイル: Events.cs プロジェクト: ChrisMoreton/Test3
		public GroupEventArgs(Group g)
		{
			group = g;
		}