Exemplo n.º 1
0
		public Box(Box prototype) : base(prototype)
		{
			style = prototype.style;

			image = prototype.image;
			transparent = prototype.transparent;

			text = prototype.text;
			ftext = null;
			textFormat = (StringFormat)prototype.textFormat.Clone();
			textColor = prototype.textColor;

			customDraw = prototype.customDraw;

			shapeRotation = prototype.shapeRotation;
			rotationAngle = prototype.rotationAngle;
			rotateContents = prototype.rotateContents;
			Shape = prototype.Shape;

			setExpandable(prototype.Expandable);
			setExpanded(prototype.Expanded);

			picturePos = prototype.picturePos;

			selStyle = prototype.selStyle;

			useTextLayout = prototype.useTextLayout;
			useStyledText = prototype.useStyledText;
			txOptions = new Text.LayoutOptions();
			txLayout = new Text.Layout();

			updateText();
			layoutText();
		}
Exemplo n.º 2
0
    private void ResetFlowChart(bool clearAll)
    {
      if (clearAll)
      {
        flowChart1.ClearAll();
      }
      else
      {
        foreach (ChartObject chartObject in flowChart1.Objects)
        {
          chartObject.Visible = false;
        }
      }

      modelBox = flowChart1.CreateBox(0.0F + flowChart1.GridSizeX / 2.0F, 0.0F + flowChart1.GridSizeY / 2.0F, 100.0F, 100.0F);
      modelBox.Visible = false;
      modelBox.RotationAngle = 0.0F;
      modelBox.Style = BoxStyle.Shape;
      modelBox.FillColor = System.Drawing.Color.FromArgb(55, 222, 184, 136);
      modelBox.FrameColor = System.Drawing.Color.FromArgb(61, 111, 92, 68);
      modelBox.ZBottom();


      modelBox.EnabledHandles = Handles.None;
      modelBox.HandlesStyle = HandlesStyle.Invisible;

      modelBox.Locked = true;

      Box backBox = flowChart1.CreateBox(0.0F + flowChart1.GridSizeX / 2.0F, 0.0F + flowChart1.GridSizeY / 2.0F, 100.0F, 100.0F);
      backBox.Style = BoxStyle.Rectangle;
      backBox.FillColor = System.Drawing.Color.FloralWhite;
      backBox.FrameColor = System.Drawing.Color.LightSlateGray;
      backBox.Locked = true;
      backBox.ZBottom();
    }
Exemplo n.º 3
0
 public Group(Guid guid, String tag, Box box, bool visible, GraphicGroup graphicGroup)
 {
   this.guid = guid;
   this.tag = tag;
   this.box = box;
   this.visible = visible;
   this.graphicGroup = graphicGroup;
 }
Exemplo n.º 4
0
 public Item(Guid guid, String tag, Box model, Box graphic, Box text, bool visible, GraphicItem graphicItem)
 {
   this.guid = guid;
   this.tag = tag;
   this.model = model;
   this.graphic = graphic;
   this.text = text;
   this.visible = visible;
   this.graphicItem = graphicItem;
 }
Exemplo n.º 5
0
    internal void SetStencil(ShapeTemplate template)
    {
      flowChart1.ClearAll();

      Box backBox = flowChart1.CreateBox(0.0F, 0.0F, 100.0F, 100.0F);
      backBox.Style = BoxStyle.Rectangle;
      backBox.FillColor = System.Drawing.Color.FromArgb(55, System.Drawing.Color.LightSlateGray);
      backBox.FrameColor = System.Drawing.Color.FromArgb(61, System.Drawing.Color.LightSlateGray);
      backBox.Locked = true;

      modelBox = flowChart1.CreateBox(0.0F, 0.0F, 100.0F, 100.0F);
      modelBox.RotationAngle = 0.0F;
      modelBox.Style = BoxStyle.Shape;
      modelBox.Shape = template;
      modelBox.FillColor = System.Drawing.Color.FromArgb(220, 222, 184, 136);
      modelBox.FrameColor = System.Drawing.Color.FromArgb(255, 111, 92, 68);
      modelBox.EnabledHandles = Handles.None;
      modelBox.HandlesStyle = HandlesStyle.Invisible;

    }
Exemplo n.º 6
0
        /// <summary>
        /// Gets Flowchart.NET box's style
        /// </summary>
        /// <param name="newBox">Box reference</param>
        /// <returns>Returned BoxStyle</returns>
        private BoxStyle GetBoxStyle(MindFusion.FlowChartX.Box newBox)
        {
            BoxStyle retStyle = BoxStyle.Shape;

            if (newBox.Shape == null)
            {
                return(newBox.Style);
            }

            if (newBox.Style != BoxStyle.Shape)
            {
                return(newBox.Style);
            }

            switch (newBox.Shape.ToString())
            {
            case "Rectangle":
                retStyle = BoxStyle.Rectangle;
                break;

            case "Ellipse":
                retStyle = BoxStyle.Ellipse;
                break;

            case "RoundRect":
                retStyle = BoxStyle.RoundedRectangle;
                break;

            default:
                retStyle = newBox.Style;
                break;
            }
            ;

            return(retStyle);
        }
Exemplo n.º 7
0
		private bool confirmBoxInplaceEdit(Box box)
		{
			if (BoxInplaceEditing == null) return true;

			BoxConfirmArgs args = new BoxConfirmArgs(box);
			BoxInplaceEditing(this, args);
			return args.Confirm;
		}
Exemplo n.º 8
0
		/// <summary>
		/// Creates a new Box instance and adds it to the flowchart.
		/// </summary>
		/// <param name="x">Horizontal position of the box.</param>
		/// <param name="y">Vertical position of the box.</param>
		/// <param name="width">Width of the box.</param>
		/// <param name="height">Height of the box.</param>
		/// <returns>A reference to the new box.</returns>
		public Box CreateBox(float x, float y, float width, float height)
		{
			// create the box object and store it in the collection
			Box newBox = new Box(this);
			newBox.setPos(x, y, width, height);

      if (!LayoutSuspended)
        Add(newBox, SelectAfterCreate);
      else
        Add(newBox, false);

			return newBox;
		}
Exemplo n.º 9
0
		/// <summary>
		/// Creates a new Arrow instance and adds it to the flowchart.
		/// </summary>
		/// <param name="srcBox">Specifies the origin box.</param>
		/// <param name="srcAnchor">Specifies the origin anchor point.</param>
		/// <param name="dstBox">Specifies the destination box.</param>
		/// <param name="dstAnchor">Specifies the destination anchor point.</param>
		/// <returns>A reference to the new arrow.</returns>
		public Arrow CreateArrow(Box srcBox, int srcAnchor, Box dstBox, int dstAnchor)
		{
			if (srcBox == null || dstBox == null) return null;

			// create the arrow object and store it in the collection
			Arrow newArrow = new Arrow(this);
			newArrow.setOrgAndDest(
				srcBox.createLink(newArrow, srcBox.getCenter(), false),
				dstBox.createLink(newArrow, dstBox.getCenter(), true));

			Add(newArrow, SelectAfterCreate);

			newArrow.OrgnAnchor = srcAnchor;
			newArrow.DestAnchor = dstAnchor;
			newArrow.updatePoints(newArrow.Points[newArrow.Points.Count-1]);

			return newArrow;
		}
Exemplo n.º 10
0
    internal ModelNode ModelNode(Box box)
    {
      ModelNode modelNode = null;

      if (box.Tag is EditorNode)
      {
        GraphicNode graphicNode = null;
        clientProtocol.graphic.Nodes.TryGetValue((box.Tag as EditorNode).Guid, out graphicNode);
        if (graphicNode != null)
          clientProtocol.model.Nodes.TryGetValue(graphicNode.ModelGuid, out modelNode);
      }

      return modelNode;
    }
Exemplo n.º 11
0
		/// <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;
		}
Exemplo n.º 12
0
		internal void fireBoxDeleted(Box box)
		{
			if (BoxDeleted != null)
				BoxDeleted(this, new BoxEventArgs(box));
		}
Exemplo n.º 13
0
		public void Insert(int i, Box b)
		{
			List.Insert(i, b);
		}
Exemplo n.º 14
0
		/// <summary>
		/// Produces SVG string path and .NET GraphicsPath using Flowchart.NET box reference
		/// </summary>
		/// <param name="newBox">Box reference</param>
		/// <returns>Returns SVG string path data</returns>
		
		public string Shape2Path ( Box newBox )
		{
			GraphicsPath gr = null;
			string sPath = "";
			gr = new GraphicsPath(FillMode.Winding);

			if ( gr!=null )
			{
				if ( newBox.Shape == null )
					sPath = Shape2Path(newBox,ref gr, null);
				else
					sPath = Complex2Path(newBox.BoundingRect, newBox.Shape.Outline, ref gr);

				gr.Dispose();
			}

			return sPath;
		}
Exemplo n.º 15
0
		/// <summary>
		/// Produces SVG string path and .NET GraphicsPath using Flowchart.NET box reference
		/// </summary>
		/// <param name="newBox">Box reference</param>
		/// <param name="gr">GraphicsPath reference</param>
		/// <param name="eta">Flowchart.NET ElementTemplate[] for complex shapes</param>
		/// <returns>Returns SVG string path data</returns>
		public string Shape2Path( Box newBox, ref GraphicsPath gr ,  ElementTemplate[] eta )
		{
			string sResult = "";
			PointF pt0 = new PointF(0,0), pt1 = new PointF(0,0), pt2 = new PointF(0,0), pt3 = new PointF(0,0);
		
			switch (newBox.Style)
			{
				case BoxStyle.Rectangle:
				
					Rect2Path(newBox.BoundingRect , ref gr);
					break;
				case BoxStyle.Ellipse:
					gr.AddEllipse(newBox.BoundingRect.X,
						newBox.BoundingRect.Y,
						newBox.BoundingRect.Width,
						newBox.BoundingRect.Height);

					
					sResult = Rect2Path(newBox.BoundingRect, ref gr ,false);

					break;
				case BoxStyle.RoundedRectangle:
					gr = Utilities.getRoundRect(newBox.BoundingRect.X,
						newBox.BoundingRect.Y,
						newBox.BoundingRect.Width,
						newBox.BoundingRect.Height,
						10);
				

					sResult = Rect2Path(newBox.BoundingRect, ref gr, false);
					break;
				case BoxStyle.Delay:
					
					sResult = Rect2Path(newBox.BoundingRect, ref gr);
				
					break;
				case BoxStyle.Rhombus:
				
					
					pt0 = new PointF(
						(newBox.BoundingRect.Left + newBox.BoundingRect.Right) / 2, newBox.BoundingRect.Top);
					pt1 = new PointF(
						Math.Max(newBox.BoundingRect.Right, newBox.BoundingRect.Left), (newBox.BoundingRect.Top + newBox.BoundingRect.Bottom) / 2);
					pt2 = new PointF(
						pt0.X, Math.Max(newBox.BoundingRect.Bottom, newBox.BoundingRect.Top));
					pt3 = new PointF(
						newBox.BoundingRect.Left, pt1.Y);
					
					pt1.X+=5;
					pt3.X-=5;
					pt2.Y+=5;
					pt0.Y-=5;
					PointF[] pts = { pt0, pt1, pt2, pt3 };

					gr.AddPolygon(pts);
									
					sResult = String.Format("M {0},{1} L{2},{3} L{4},{5} L{6},{7} z",
						Unit2Pix((newBox.BoundingRect.Left + newBox.BoundingRect.Right) / 2) ,Unit2Pix(newBox.BoundingRect.Top),
						Unit2Pix(Math.Max(newBox.BoundingRect.Right, newBox.BoundingRect.Left)), Unit2Pix((newBox.BoundingRect.Top + newBox.BoundingRect.Bottom)/2),
						Unit2Pix(pt0.X) , Unit2Pix(Math.Max(newBox.BoundingRect.Bottom, newBox.BoundingRect.Top)),
						Unit2Pix(newBox.BoundingRect.Left), Unit2Pix(pt1.Y));
					
				
					break;
				case BoxStyle.Shape:
					if ( eta != null )
					{
						sResult = Complex2Path(newBox.BoundingRect, eta , ref gr);
					}
					break;

			}

			return sResult;
		}
Exemplo n.º 16
0
 private static void RecusionFlowBranch(Box box, ref List<Box> boxList)
 {
     boxList.Add(box);
     if (box.OutgoingArrows.Count==0&&!MainFormExt.EndElements.Contains(box))
     {
         boxList = null;
         return ;
     }
     foreach (Arrow arrow in box.OutgoingArrows)
     {
         RecusionFlowBranch((Box)arrow.Destination, ref boxList);
     }
 }
Exemplo n.º 17
0
    private void newToolStripMenuItem_Click(object sender, EventArgs e)
    {
      elementTextBox.Text = "";
      decorationTextBox.Text = "";
      tagAreaTextBox.Text = "";

      Text = "*Untitled*";

      graphicStencil.Elements = new System.Collections.ArrayList();
      graphicStencil.Decorations = new System.Collections.ArrayList();

      modelStencil.Elements = new System.Collections.ArrayList();
      modelStencil.Decorations = new System.Collections.ArrayList();
      modelStencil.Anchors = new System.Collections.ArrayList();

      flowChart1.DocExtents = new RectangleF(-1.0F, -1.0F, 2.0F, 2.0F);
      flowChart1.ZoomToRect(new RectangleF(-1.0F, -1.0F, 2.0F, 2.0F));

      box1 = flowChart1.CreateBox(-1.0F, -1.0F, 2.0F, 2.0F);
      box1.Locked = true;
      box1.Style = MindFusion.FlowChartX.BoxStyle.Shape;

      {
        GraphicStencil stencil = graphicStencil;
        bool mirrorX = false;
        bool mirrorY = false;

        ElementTemplate[] elementTemplate = new ElementTemplate[stencil.Elements.Count];
        {
          int i = 0;
          foreach (Element element in stencil.Elements)
          {
            if (element is Arc)
            {
              elementTemplate[i] = new ArcTemplate(
                (float)(element as Arc).x,
                (float)(element as Arc).y,
                (float)(element as Arc).w,
                (float)(element as Arc).h,
                (float)(element as Arc).a,
                (float)(element as Arc).s);
            }
            if (element is Line)
            {
              Line line = element as Line;
              double x1, y1, x2, y2;

              if (mirrorX)
                x1 = 100.0 - line.x1;
              else
                x1 = line.x1;

              if (mirrorY)
                y1 = 100.0 - line.y1;
              else
                y1 = line.y1;

              if (mirrorX)
                x2 = 100.0 - line.x2;
              else
                x2 = line.x2;

              if (mirrorY)
                y2 = 100.0 - line.y2;
              else
                y2 = line.y2;

              elementTemplate[i] = new LineTemplate((float)x1, (float)y1, (float)x2, (float)y2);
            }
            if (element is Bezier)
            {
              Bezier bezier = element as Bezier;
              double x1, y1, x2, y2, x3, y3, x4, y4;

              if (mirrorX)
                x1 = 100.0 - bezier.x1;
              else
                x1 = bezier.x1;

              if (mirrorY)
                y1 = 100.0 - bezier.y1;
              else
                y1 = bezier.y1;

              if (mirrorX)
                x2 = 100.0 - bezier.x2;
              else
                x2 = bezier.x2;

              if (mirrorY)
                y2 = 100.0 - bezier.y2;
              else
                y2 = bezier.y2;

              if (mirrorX)
                x3 = 100.0 - bezier.x3;
              else
                x3 = bezier.x3;

              if (mirrorY)
                y3 = 100.0 - bezier.y3;
              else
                y3 = bezier.y3;

              if (mirrorX)
                x4 = 100.0 - bezier.x4;
              else
                x4 = bezier.x4;

              if (mirrorY)
                y4 = 100.0 - bezier.y4;
              else
                y4 = bezier.y4;

              elementTemplate[i] = new BezierTemplate((float)x1, (float)y1, (float)x2, (float)y2, (float)x3, (float)y3, (float)x4, (float)y4);
            }
            i++;
          }
        }

        ElementTemplate[] decorationTemplate = new ElementTemplate[stencil.Decorations.Count];
        {
          int i = 0;
          foreach (Element decoration in stencil.Decorations)
          {
            if (decoration is Arc)
            {
              decorationTemplate[i] = new ArcTemplate(
                (float)(decoration as Arc).x,
                (float)(decoration as Arc).y,
                (float)(decoration as Arc).w,
                (float)(decoration as Arc).h,
                (float)(decoration as Arc).a,
                (float)(decoration as Arc).s);
            }
            if (decoration is Line)
            {
              decorationTemplate[i] = new LineTemplate(
                (float)(decoration as Line).x1,
                (float)(decoration as Line).y1,
                (float)(decoration as Line).x2,
                (float)(decoration as Line).y2);
            }
            if (decoration is Bezier)
            {
              decorationTemplate[i] = new BezierTemplate(
                (float)(decoration as Bezier).x1,
                (float)(decoration as Bezier).y1,
                (float)(decoration as Bezier).x2,
                (float)(decoration as Bezier).y2,
                (float)(decoration as Bezier).x3,
                (float)(decoration as Bezier).y3,
                (float)(decoration as Bezier).x4,
                (float)(decoration as Bezier).y4);
            }
            i++;
          }
        }

        box1.Shape = (new ShapeTemplate(elementTemplate, decorationTemplate, new ElementTemplate[0], stencil.fillMode, stencil.Tag));
      }


      textBox1 = flowChart1.CreateBox(-1.0F, -1.0F, 2.0F, 2.0F);
      textBox1.Locked = true;
      //textBox1.Style = MindFusion.FlowChartX.BoxStyle.Shape;
      //textBox1.Shape = graphicStencil.TextShapeTemplate(false, false);
      textBox1.Shape = MindFusion.FlowChartX.ShapeTemplate.Decision;

      flowChart2.DocExtents = new RectangleF(-1.0F, -1.0F, 2.0F, 2.0F);
      flowChart2.ZoomToRect(new RectangleF(-1.0F, -1.0F, 2.0F, 2.0F));

      box2 = flowChart2.CreateBox(-1.0F, -1.0F, 2.0F, 2.0F);
      box2.Locked = true;
      box2.Style = MindFusion.FlowChartX.BoxStyle.Shape;
      {
        int i;

        ModelStencil stencil = modelStencil;
        bool mirrorX = false;
        bool mirrorY = false;

        ElementTemplate[] elementTemplate = new ElementTemplate[stencil.Elements.Count];
        i = 0;
        foreach (Element element in stencil.Elements)
        {
          if (element is Arc)
          {
            Arc arc = element as Arc;
            elementTemplate[i] = new ArcTemplate((float)arc.x, (float)arc.y, (float)arc.w, (float)arc.h, (float)arc.a, (float)arc.s);
          }
          if (element is Line)
          {
            Line line = element as Line;
            double x1, y1, x2, y2;

            if (mirrorX)
              x1 = 100.0 - line.x1;
            else
              x1 = line.x1;

            if (mirrorY)
              y1 = 100.0 - line.y1;
            else
              y1 = line.y1;

            if (mirrorX)
              x2 = 100.0 - line.x2;
            else
              x2 = line.x2;

            if (mirrorY)
              y2 = 100.0 - line.y2;
            else
              y2 = line.y2;

            elementTemplate[i] = new LineTemplate((float)x1, (float)y1, (float)x2, (float)y2);
          }
          if (element is Bezier)
          {
            Bezier bezier = element as Bezier;
            double x1, y1, x2, y2, x3, y3, x4, y4;

            if (mirrorX)
              x1 = 100.0 - bezier.x1;
            else
              x1 = bezier.x1;

            if (mirrorY)
              y1 = 100.0 - bezier.y1;
            else
              y1 = bezier.y1;

            if (mirrorX)
              x2 = 100.0 - bezier.x2;
            else
              x2 = bezier.x2;

            if (mirrorY)
              y2 = 100.0 - bezier.y2;
            else
              y2 = bezier.y2;

            if (mirrorX)
              x3 = 100.0 - bezier.x3;
            else
              x3 = bezier.x3;

            if (mirrorY)
              y3 = 100.0 - bezier.y3;
            else
              y3 = bezier.y3;

            if (mirrorX)
              x4 = 100.0 - bezier.x4;
            else
              x4 = bezier.x4;

            if (mirrorY)
              y4 = 100.0 - bezier.y4;
            else
              y4 = bezier.y4;

            elementTemplate[i] = new BezierTemplate((float)x1, (float)y1, (float)x2, (float)y2, (float)x3, (float)y3, (float)x4, (float)y4);
          }
          i++;
        }

        ElementTemplate[] decorationTemplate = new ElementTemplate[stencil.Decorations.Count];
        i = 0;
        foreach (Element decoration in stencil.Decorations)
        {
          if (decoration is Arc)
          {
            Arc arc = decoration as Arc;
            decorationTemplate[i] = new ArcTemplate((float)arc.x, (float)arc.y, (float)arc.w, (float)arc.h, (float)arc.a, (float)arc.s);
          }
          if (decoration is Line)
          {
            Line line = decoration as Line;
            double x1, y1, x2, y2;

            if (mirrorX)
              x1 = 100.0 - line.x1;
            else
              x1 = line.x1;

            if (mirrorY)
              y1 = 100.0 - line.y1;
            else
              y1 = line.y1;

            if (mirrorX)
              x2 = 100.0 - line.x2;
            else
              x2 = line.x2;

            if (mirrorY)
              y2 = 100.0 - line.y2;
            else
              y2 = line.y2;

            decorationTemplate[i] = new LineTemplate((float)x1, (float)y1, (float)x2, (float)y2);
          }
          if (decoration is Bezier)
          {
            Bezier bezier = decoration as Bezier;
            double x1, y1, x2, y2, x3, y3, x4, y4;

            if (mirrorX)
              x1 = 100.0 - bezier.x1;
            else
              x1 = bezier.x1;

            if (mirrorY)
              y1 = 100.0 - bezier.y1;
            else
              y1 = bezier.y1;

            if (mirrorX)
              x2 = 100.0 - bezier.x2;
            else
              x2 = bezier.x2;

            if (mirrorY)
              y2 = 100.0 - bezier.y2;
            else
              y2 = bezier.y2;

            if (mirrorX)
              x3 = 100.0 - bezier.x3;
            else
              x3 = bezier.x3;

            if (mirrorY)
              y3 = 100.0 - bezier.y3;
            else
              y3 = bezier.y3;

            if (mirrorX)
              x4 = 100.0 - bezier.x4;
            else
              x4 = bezier.x4;

            if (mirrorY)
              y4 = 100.0 - bezier.y4;
            else
              y4 = bezier.y4;

            decorationTemplate[i] = new BezierTemplate((float)x1, (float)y1, (float)x2, (float)y2, (float)x3, (float)y3, (float)x4, (float)y4);
          }
          i++;
        }

        box2.Shape = (new ShapeTemplate(elementTemplate, decorationTemplate, null, stencil.FillMode, stencil.Tag));
      }
    }
Exemplo n.º 18
0
		public BoxLink(Box box, Arrow arrow, bool incoming) :
			base(arrow, incoming)
		{
			this.box = box;
		}
Exemplo n.º 19
0
		public override void setReference(int refId, IPersists obj)
		{
			base.setReference(refId,obj);

			if (refId == 2)
				box = (Box)obj;
		}
Exemplo n.º 20
0
    internal GraphicArea GraphicArea(Box box)
    {
      GraphicArea graphicArea = null;

      if (box.Tag is EditorNode)
        clientProtocol.graphic.Areas.TryGetValue((box.Tag as EditorNode).Guid, out graphicArea);
      return graphicArea;
    }
Exemplo n.º 21
0
		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);
		}
Exemplo n.º 22
0
		/// <summary>
		/// Gets GraphicsPath of the Box's TextArea
		/// </summary>
		/// <param name="oBox">Flowchart box</param>
		/// <param name="Offset">Box offset if necessary</param>
		/// <param name="gr">Graphics path to be assigned</param>
		/// <returns>true if successfull otherwise false</returns>
		public bool TextBox2Path( Box oBox, float Offset, ref GraphicsPath gr )
		{
			string result = null;
			ElementTemplate[] et= null;

			if ( oBox.Shape != null )
			{
				if ( oBox.Shape.TextArea!=null)
					et = oBox.Shape.TextArea;
				else
					et = oBox.Shape.Outline;
			}

			return Shape2Str(oBox.BoundingRect, oBox.Style, et ,
				oBox.Pen.Color, ( - oBox.RotationAngle + oBox.ShapeOrientation) , oBox.Pen.DashStyle, oBox.Pen.Width,
				Offset, false, ref gr, ref result);
		}
Exemplo n.º 23
0
		internal void drawBox(Graphics g, Box box, bool shadow, RectangleF rc)
		{
			if (DrawBox != null)
				DrawBox(this, new BoxDrawArgs(g, box, shadow, rc));
		}
Exemplo n.º 24
0
		internal BoxState(Box box) : base(box)
		{
			rotationAngle = 0;
		}
Exemplo n.º 25
0
		public void Add(Box b)
		{
			List.Add(b);
		}
Exemplo n.º 26
0
        /// <summary>
        /// Converts Flowchart.NET box into SVG
        /// </summary>
        /// <param name="newArrow">Box reference</param>
        /// <returns>TRUE if successfull otherwise FALSE</returns>
        private bool CreateBox(MindFusion.FlowChartX.Box newBox)
        {
            bool  bOk = false;
            float fX = 0, fY = 0, fW = 0, fH = 0, fLine = 0;
            long  lLine = 0;

            XmlNode last_node = null;

            try
            {
                if (newBox == null)
                {
                    throw new Exception("Empty box reference passed");
                }

                if ((!newBox.Visible) && (!InvisibleItems))
                {
                    return(true);
                }

                if ((newBox.Transparent) && (newBox.Image == null))
                {
                    sMan.AddText(newBox);
                    return(true);
                }


                fX    = newBox.BoundingRect.X;
                fY    = newBox.BoundingRect.Y;
                fW    = newBox.BoundingRect.Width;
                fH    = newBox.BoundingRect.Height;
                fLine = newBox.Pen.Width;

                if ((newBox.ShapeOrientation == 90) || (newBox.ShapeOrientation == 270))
                {
                    float lTemp = fW;
                    fW = fH;
                    fH = lTemp;
                }

                lLine = Unit2Pix(fLine);
                if (lLine == 0)
                {
                    lLine = 1;
                }

                //Color boxFillColor = newBox.Locked ? Color.Transparent : newBox.FillColor;
                Color boxFillColor = newBox.FillColor;


                switch (GetBoxStyle(newBox))
                {
                case BoxStyle.Rhombus:
                    last_node = sMan.AddPath(sMan.Shape2Path(newBox),
                                             String.Format("{0}px", lLine),
                                             newBox.Pen.Color,
                                             boxFillColor);
                    break;

                case BoxStyle.Ellipse:


                    last_node = sMan.AddEllipse(String.Format("{0}px", Unit2Pix(fX + fW / 2)),
                                                String.Format("{0}px", Unit2Pix(fY + fH / 2)),
                                                String.Format("{0}px", Unit2Pix(fW / 2)),
                                                String.Format("{0}px", Unit2Pix(fH / 2)), String.Format("{0}px", lLine),
                                                boxFillColor,
                                                newBox.Pen.Color);


                    break;

                case BoxStyle.Rectangle:
                    last_node = sMan.AddRect(String.Format("{0}px", Unit2Pix(fX)),
                                             String.Format("{0}px", Unit2Pix(fY)),
                                             String.Format("{0}px", Unit2Pix(fW)),
                                             String.Format("{0}px", Unit2Pix(fH)),
                                             String.Format("{0}px", lLine),
                                             boxFillColor,
                                             newBox.Pen.Color,
                                             null,
                                             null,
                                             newBox.Image,
                                             newBox.Transparent ? pChart.BackColor : Color.Empty);

                    break;

                case BoxStyle.RoundedRectangle:

                    last_node = sMan.AddRect(String.Format("{0}px", Unit2Pix(fX)),
                                             String.Format("{0}px", Unit2Pix(fY)),
                                             String.Format("{0}px", Unit2Pix(fW)),
                                             String.Format("{0}px", Unit2Pix(fH)),
                                             String.Format("{0}px", lLine),
                                             boxFillColor,
                                             newBox.Pen.Color,
                                             "10px",
                                             "10px",
                                             newBox.Image,
                                             newBox.Transparent ? pChart.BackColor : Color.Empty);
                    break;

                case BoxStyle.Shape:
                case BoxStyle.Delay:
                default:

                    last_node = sMan.AddPath(sMan.Shape2Path(newBox),
                                             String.Format("{0}px", lLine),
                                             newBox.Pen.Color,
                                             boxFillColor);

                    break;
                }

                sMan.AddGradient(last_node, newBox.Brush);
                sMan.AddRotation(last_node, newBox);
                sMan.AddText(newBox);
                bOk = true;
            }

            catch (Exception ex)
            {
                Trace.WriteLine(String.Format("{0} error {1}\n", "CreateBox", ex.Message));
                bOk = false;
            }

            return(bOk);
        }
Exemplo n.º 27
0
		public void Remove(Box b)
		{
			List.Remove(b);
		}
Exemplo n.º 28
0
 internal GraphicNode GraphicNode(Box box)
 {
   GraphicNode graphicNode = null;
   if (box.Tag is EditorNode)
     graphicNode = GraphicNode((box.Tag as EditorNode).Guid);
   return graphicNode;
 }
Exemplo n.º 29
0
		/// <summary>
		/// Modifies SVG 'transform' attribute to implement a rotation
		/// </summary>
		/// <param name="ShapeNode">SVG XCML node refence</param>
		/// <param name="newBox">Box reference</param>
		/// <returns>TRUE is successfull otherwise FALSE</returns>
		public bool AddRotation(XmlNode ShapeNode, Box newBox)
		{
			bool bOk = false;
			long lAngle = 0;
			try
			{
				if ( newBox == null )
					return true;

				if ( ShapeNode == null )
					return true;

				if ( ( newBox.RotationAngle + newBox.ShapeOrientation )== 0 )
					return true;

				if ( (newBox.RotationAngle + newBox.ShapeOrientation)> 180 )
					lAngle = (long) ((-1) *(360 - (newBox.RotationAngle+newBox.ShapeOrientation)));
				else
					lAngle = (long) (newBox.RotationAngle + newBox.ShapeOrientation);

				
				ShapeNode.Attributes.Append(m_InnerDoc.CreateAttribute("transform"));
				ShapeNode.Attributes["transform"].Value = String.Format("rotate({0} {1}px {2}px)", lAngle,
					Unit2Pix(newBox.BoundingRect.X + newBox.BoundingRect.Width/2),Unit2Pix(newBox.BoundingRect.Y + newBox.BoundingRect.Height/2));
			
				bOk = true;

			}
			catch (Exception ex)
			{

				Trace.WriteLine(String.Format("{0} error {1}\n","SvgManager.AddRotation)",ex.Message));
				bOk = false;
		
			}
			return bOk;

		}
Exemplo n.º 30
0
		/// <summary>
		/// Converts Visio shape type into Flowchart.NET predefined shape
		/// </summary>
		/// <param name="sVisioShape">Visio shape type</param>
		/// <returns>Flowchart.NET predefinded shape reference or [null] if some error occured</returns>
		private MindFusion.FlowChartX.ShapeTemplate VisioShape2PredefinedShape( string sVisioShape , ref Box oBox , ref bool DontHideGroup, ref Color FillColor )
		{
			string Result = "Rectangle";
			MindFusion.FlowChartX.ShapeTemplate templ = null;
			
			try
			{
				DontHideGroup = false;
				if (( sVisioShape == "" ) || ( sVisioShape == null))
					sVisioShape = "Process";

				sVisioShape = sVisioShape.Trim();
				sVisioShape = sVisioShape.ToLower();

				if ( sVisioShape == "process")
					Result = "Rectangle";
				else if  ( sVisioShape.IndexOf("person") >=0 )
					Result = "Actor";
				else if  ( sVisioShape.IndexOf("45 degree single") >=0 )
					Result = "Arrow3";
				else if  ( sVisioShape.IndexOf("foreign") >=0 )
					Result = "Rectangle";
				else if  ( sVisioShape.IndexOf("45 degree tail") >=0 )
					Result = "Arrow3";
				else if  ( sVisioShape.IndexOf("60 degree single") >=0 )
					Result = "Arrow3";
				else if  ( sVisioShape.IndexOf("curved arrow") >=0 )
					Result = "Arrow3";
				else if  ( sVisioShape.IndexOf("60 degree tail") >=0 )
					Result = "Arrow3";
				else if  ( sVisioShape.IndexOf("45 degree double") >=0 )
					Result = "Arrow5";
				else if  ( sVisioShape.IndexOf("60 degree double") >=0 )
					Result = "Arrow5";
				else if  ( sVisioShape.IndexOf("2-d double") >=0 )
					Result = "Arrow5";
				else if  ( sVisioShape.IndexOf("2-d single") >=0 )
					Result = "Arrow3";
				else if  ( sVisioShape.IndexOf("1-d double") >=0 )
					Result = "Arrow5";
				else if  ( sVisioShape.IndexOf("1-d open end") >=0 )
					Result = "Arrow3";
				else if  ( sVisioShape.IndexOf("1-d single") >=0 )
					Result = "Arrow3";
				else if  ( sVisioShape.IndexOf("double flexi-arrow") >=0 )
					Result = "Arrow5";
				else if  ( sVisioShape.IndexOf("flexi-arrow") >=0 )
					Result = "Arrow4";
				else if  ( sVisioShape.IndexOf("fancy arrow") >=0 )
					Result = "Arrow4";
				else if  ( sVisioShape.IndexOf("loop limit") >=0 )
					Result = "BeginLoop";
				else if  ( sVisioShape == "object" )
					Result = "Cloud";
				else if  ( sVisioShape.IndexOf("preparation") >=0 )
					Result = "DataTransmition";
				else if  ( sVisioShape.IndexOf("stored data") >=0 )
					Result = "DDelay";
				else if  ( sVisioShape.IndexOf("diamond") >=0 )
					Result = "Decision";
				else if  ( sVisioShape.IndexOf("decision") >=0 )
					Result = "Decision";
				else if  ( sVisioShape.IndexOf("display") >=0 )
					Result = "Display";
				else if  ( sVisioShape.IndexOf("document") >=0 )
					Result = "Document";
				else if  ( sVisioShape.IndexOf("control transfer") >=0 )
					Result = "Interrupt";
				else if  ( sVisioShape.IndexOf("lined document") >=0 )
					Result = "LinedDocument";
				else if  ( sVisioShape.IndexOf("manual operation") >=0 )
					Result = "ManualOperation";
				else if  ( sVisioShape.IndexOf("extract") >=0 )
					Result = "Alternative";
				else if  ( sVisioShape.IndexOf("file") >=0 )
					Result = "File";
				else if  ( sVisioShape.IndexOf("sequential data") >=0 )
					Result = "Tape";
				else if  ( sVisioShape.IndexOf("terminator") >=0 )
					Result = "Terminator";
				else if  ( sVisioShape == "data" )
					Result = "Save";
				else if  ( sVisioShape.IndexOf("internal storage") >=0 )
					Result = "InternalStorage";
				else if  ( sVisioShape.IndexOf("triangle") >=0 )
				{
					Result = "Alternative";
					//	PinY*=2;
				}
				else if  ( sVisioShape.IndexOf("heptagon") >=0 )
				{
					Result = "Heptagon";
				}
				else if  ( sVisioShape.IndexOf("hexagon") >=0 )
				{
					Result = "Decision2";

				}
				else if  ( sVisioShape.IndexOf("pentagon") >=0 )
				{
					Result = "Pentagon";
					//	PinY*=1.5;
				}
				else if  ( sVisioShape.IndexOf("octagon") >=0 )
				{
					Result = "Octagon";
			
				}
				else if  ( sVisioShape.IndexOf("cross") >=0 )
					Result = "Cross";
				else if  ( sVisioShape == "star")
					Result = "Star";
				else if  ( sVisioShape.IndexOf("circle") >=0 )
					Result = "Ellipse";
				else if  ( sVisioShape.IndexOf("ellipse") >=0 )
					Result = "Ellipse"; 
				else if  ( sVisioShape.IndexOf("rounded rectangle") >=0 )
					Result = "RoundRect"; //
				else if  ( sVisioShape.IndexOf("predefined process") >=0 )
					Result = "Procedure";
				else if  ( sVisioShape.IndexOf("direct data") >=0 )
					Result = "DirectAccessStorage";
				else if  ( sVisioShape.IndexOf("manual input") >=0 )
					Result = "Input";
				else if  ( sVisioShape.IndexOf("card") >=0 )
					Result = "PunchedCard";
				else if  ( sVisioShape.IndexOf("paper tape") >=0 )
					Result = "Microform";
				else if  ( sVisioShape.IndexOf("on-page reference") >=0 )
					Result = "Ellipse";
				else if  ( sVisioShape.IndexOf("off-page reference") >=0 )
					Result = "OffpageReference";
				else if  ( sVisioShape.IndexOf("note") >=0 )
				{
					DontHideGroup = true;
					Result = "File";
				}
				else if  ( sVisioShape.IndexOf("data process") >=0 )
					Result = "Ellipse";
				else if  ( sVisioShape.IndexOf("multiple process") >=0 )
					Result = "Ellipse";
#if _POST_FIX_2_1
#else
				else if  ( sVisioShape == "state" )
					Result = "Ellipse";
#endif
				else if  ( sVisioShape == "start state")
					Result = "Ellipse";
				else if  ( sVisioShape == "stop state 2")
					Result = "Merge";
				else if  ( sVisioShape == "stop state")
					Result = "Ellipse";
				else if  ( sVisioShape.IndexOf("multi state") >=0 )
					Result = "Ellipse";
				else if  ( sVisioShape == "entity")
					Result = "Rectangle";
				else if  ( sVisioShape == "oval process")
					Result = "Ellipse";
				else if  ( sVisioShape == "category")
					Result = "Ellipse";
				else if  ( sVisioShape == "entity relationship")
					Result = "Decision";
#if _POST_FIX_2_1
				else if  ( sVisioShape == "action state")
				{
					DontHideGroup = true;
					Result = "Terminator";
				}
				else if  ( sVisioShape == "state")
				{
					DontHideGroup = true;
					Result = "RoundRect";
				}
				else if  ( sVisioShape == "initial state")
				{
					DontHideGroup = true;
					Result = "Ellipse";
					FillColor = Color.Black;
				}
				else if  ( sVisioShape == "final state")
				{
					DontHideGroup = true;
					Result = "Ellipse";
				}
				else if  ( sVisioShape.IndexOf("transition")>=0)
				{
					DontHideGroup = true;
					Result = "Rectangle";
					FillColor = Color.Black;
				}
				else if  ( sVisioShape == "object in state")
				{
					DontHideGroup = true;
					Result = "Rectangle";
				}
				else if  ( sVisioShape == "swimlane")
				{
					Result = "Rectangle";
					if (oBox != null)
						oBox.Transparent = true;

					//FillColor = Color.Transparent;
						
				}
				else if  ( sVisioShape == "signal receipt")
				{
					DontHideGroup = true;
					Result = "MessageFromUser";
				}
				else if  ( sVisioShape == "signal send")
				{
					Result = "MessageToUser";
					DontHideGroup = true;
					if (oBox != null)
						oBox.ShapeOrientation = 180;
				}
				else if  ( sVisioShape == "constraint")
				{
					DontHideGroup = true;
					Result = "File";
				}
				else if  ( sVisioShape == "watermark title")
				{
					Result = "Rectangle";
					if (oBox != null)
						oBox.Transparent = true;
					
					//FillColor = Color.Transparent;
				}
					
#endif
				else
					Result = "Rectangle";
		
				templ = ShapeTemplate.FromId(Result);

			}
			catch (Exception ex)
			{
				templ = null;
				Trace.WriteLine(String.Format("{0} error {1}\n","VisioShape2PredefinedShape",ex.Message));
			}
			return templ;
		

		}
Exemplo n.º 31
0
		/// <summary>
		/// Produces DXF output for Flowchart Box
		/// </summary>
		/// <param name="oBox">Flowchart box</param>
		/// <param name="Offset">Offset if necessary</param>
		/// <param name="gr">GraphicsPath to be assigned</param>
		/// <param name="result">DXF output string</param>
		/// <returns>true if successfull otherwise false</returns>
		public bool Box2Str( Box oBox, float Offset, ref GraphicsPath gr, ref string result )
		{
			return Shape2Str(oBox.BoundingRect, oBox.Style, ( oBox.Shape == null ) ? null : oBox.Shape.Outline,
				oBox.Pen.Color,  ( - oBox.RotationAngle + oBox.ShapeOrientation) , oBox.Pen.DashStyle, oBox.Pen.Width,
				Offset, true, ref gr, ref result);
		}
Exemplo n.º 32
0
		public BoxImportedArgs(Box box, string shapeName)
		{
			this.box = box;
			this.shapeName = shapeName;
		}