Exemplo n.º 1
0
 private static void addNewItem(MoveCorner item)
 {
     if (MoveCorner.values == null)
     {
         MoveCorner.values = new List<MoveCorner>();
     }
     MoveCorner.values.Add(item);
 }
Exemplo n.º 2
0
 public void setPositionParametersForResize(MoveCorner moveCorner, PointF offset)
 {
     float radiusOffset = Math.Min(offset.X, offset.Y);
     switch (moveCorner.Value)
     {
         case "TOPLEFT":
             radiusOffset = Math.Min((-1) * offset.X, (-1) * offset.Y);
             break;
         case "TOPRIGHT":
             radiusOffset = Math.Min(offset.X, (-1) * offset.Y);
             break;
         case "BOTTOMLEFT":
             radiusOffset = Math.Min((-1) * offset.X, offset.Y);
             break;
         case "BOTTOMRIGHT":
             radiusOffset = Math.Min(offset.X, offset.Y);
             break;
     }
     this.Radius = this.Radius + radiusOffset;
 }
Exemplo n.º 3
0
 public void setNoteParametersForResize(MoveCorner moveCorner, PointF offset)
 {
     PointF moveOffset = offset;
     switch (moveCorner.Value)
     {
         case "TOPLEFT":
             moveOffset = new PointF((-1) * offset.X, (-1) * offset.Y);
             break;
         case "TOPRIGHT":
             moveOffset = new PointF(offset.X, (-1) * offset.Y);
             break;
         case "BOTTOMLEFT":
             moveOffset = new PointF((-1) * offset.X, offset.Y);
             break;
         case "BOTTOMRIGHT":
             moveOffset = new PointF(offset.X, offset.Y);
             break;
     }
     this.Size = new SizeF(this.Size.Width + moveOffset.X, this.Size.Height + moveOffset.Y);
 }
Exemplo n.º 4
0
 private void pbPetriNetwork_MouseDown(object sender, MouseEventArgs e)
 {
     AbstractItem item = null;
     this.startCoordinatesF = this.convertPixelToCoord(e.X, e.Y);
     this.startCoordinates = this.pbPetriNetwork.PointToScreen(new Point(e.X, e.Y));
     switch ((this.MdiParent as MDIParent).SelectedToolboxItem)
     {
         case NetworkToolboxItem.EDGE:
             item = this.petriNetwork.getVisualItemByCoordinates(this.startCoordinatesF);
             if ((item != null) && ( item is AbstractNetworkItem ))
             {
                 bool valid = true;
                 if (item is AbstractTransition)
                 {
                     if (TransitionType.SINK.Equals(((AbstractTransition)item).TransitionType))
                     {
                         valid = false;
                     }
                 }
                 if (valid)
                 {
                     AbstractNetworkItem networkItem = (AbstractNetworkItem)item;
                     this.startEdge = networkItem;
                     this.endCoordinates = this.startCoordinates;
                     this.isStartEdgeAvailable = true;
                     this.isStartSelectRectangle = false;
                     this.isStartMove = false;
                     if (!(networkItem is AbstractNote))
                     {
                         this.drawPetriNetwork(networkItem, null);
                     }
                 }
             }
             break;
         case NetworkToolboxItem.SELECT:
             this.isStartEdgeAvailable = false;
             this.isStartSelectRectangle = true;
             this.isStartMove = false;
             break;
         case NetworkToolboxItem.MOVE:
             // search sizeable corner
             SearchItemResultTransfer searchItemResultTransfer = this.petriNetwork.getVisualItemEdgesByCoordinates(this.startCoordinatesF);
             if (searchItemResultTransfer != null)
             {
                 item = searchItemResultTransfer.Item;
                 this.moveCorner = searchItemResultTransfer.MoveEdge;
             }
             else
             {
                 item = this.petriNetwork.getVisualItemByCoordinates(this.startCoordinatesF);
                 this.moveCorner = MoveCorner.NONE;
             }
             if ((item != null) && (item is AbstractItem))
             {
                 AbstractItem networkItem = (AbstractItem)item;
                 this.moveItem = networkItem;
                 this.endCoordinates = this.startCoordinates;
                 this.isStartEdgeAvailable = false;
                 this.isStartSelectRectangle = false;
                 this.isStartMove = true;
             }
             break;
     }
 }
Exemplo n.º 5
0
 public bool isNearby(MoveCorner moveEdge, PointF point)
 {
     PointF custom = this.point;
     switch (moveEdge.Value)
     {
         case "TOPLEFT":
             custom = this.point;
             break;
         case "TOPRIGHT":
             custom = new PointF(this.point.X + this.size.Width, this.point.Y);
             break;
         case "BOTTOMLEFT":
             custom = new PointF(this.point.X, this.point.Y + this.size.Height);
             break;
         case "BOTTOMRIGHT":
             custom = new PointF(this.point.X + this.size.Width, this.point.Y + this.size.Height);
             break;
         case "LABEL":
             custom = new PointF(this.point.X + (this.size.Width / 2) + this.labelOffset.X, this.point.Y - AbstractNetworkItem.LABEL_HELP_ELLIPSE_OFFSET + this.labelOffset.Y);
             break;
     }
     return this.isNearby(custom, point, this.NearByDistanceForMoveEdge);
 }
Exemplo n.º 6
0
 public SearchItemResultTransfer(AbstractItem item, MoveCorner moveEdge)
 {
     this.item = item;
     this.moveEdge = moveEdge;
 }