private int GetIncreaseOrDecreaseIndex(int senderIndex,IRectLayer layer) { int res = 0; if (!MyScreen.SenderConnectInfoList[senderIndex].IsStatIncreaseOrDecreaseIndex) { double maxDviWidth = _mainControlSize.Width - SmartLCTViewModeBase.ScrollWidth; double maxDviHeight = _mainControlSize.Height - SmartLCTViewModeBase.ScrollWidth; int widthDecreaseIndex = -1; int heightDecreaseIndex = -1; double layerHeight = layer.Height / SmartLCTViewModeBase.IncreaseOrDecreaseValue; double layWidth = layer.Width / SmartLCTViewModeBase.IncreaseOrDecreaseValue; while (layWidth > maxDviWidth) { layWidth = layWidth / SmartLCTViewModeBase.IncreaseOrDecreaseValue; widthDecreaseIndex -= 1; } while (layerHeight > maxDviHeight) { layerHeight = layerHeight / SmartLCTViewModeBase.IncreaseOrDecreaseValue; heightDecreaseIndex -= 1; } if (Math.Abs(heightDecreaseIndex) > Math.Abs(widthDecreaseIndex)) { res = heightDecreaseIndex; } else { res = widthDecreaseIndex; } } else { res = MyScreen.SenderConnectInfoList[senderIndex].IncreaseOrDecreaseIndex; } return res; }
private Point GetDviCenterPoint(int increaseOrDecreaseIndex, IRectLayer layer) { Point res = new Point(); double changedValue = Math.Pow(SmartLCTViewModeBase.IncreaseOrDecreaseValue, increaseOrDecreaseIndex); res.X = (int)(_mainControlSize.Width - layer.Width * changedValue) / 2 / changedValue; res.Y = (int)(_mainControlSize.Height - layer.Height * changedValue) / 2 / changedValue; if (res.X < 0) { res.X = 0; } if (res.Y < 0) { res.Y = 0; } return res; }
private int GetOriginalIncreaseOrDecreaseIndex(IRectLayer layer) { int res = 0; double maxDviWidth = this.ActualWidth - SmartLCTViewModeBase.ScrollWidth; double maxDviHeight = this.ActualHeight - SmartLCTViewModeBase.ScrollWidth; int widthDecreaseIndex = -1; int heightDecreaseIndex = -1; double layerHeight = layer.Height / SmartLCTViewModeBase.IncreaseOrDecreaseValue; double layWidth = layer.Width / SmartLCTViewModeBase.IncreaseOrDecreaseValue; while (layWidth > maxDviWidth) { layWidth = layWidth / SmartLCTViewModeBase.IncreaseOrDecreaseValue; widthDecreaseIndex -= 1; } while (layerHeight > maxDviHeight) { layerHeight = layerHeight / SmartLCTViewModeBase.IncreaseOrDecreaseValue; heightDecreaseIndex -= 1; } if (Math.Abs(heightDecreaseIndex) > Math.Abs(widthDecreaseIndex)) { res = heightDecreaseIndex; } else { res = widthDecreaseIndex; } return res; }
public DeleteAction(IRectLayer rectLayer,ObservableCollection<IElement> elementCollection) { MyRectLayer = rectLayer; ElementCollection = elementCollection; }
private int GetNextIndexInPort(IRectLayer screenLayer) { int nextIndex = 0; for (int i = 0; i < screenLayer.SenderConnectInfoList.Count; i++) { if (screenLayer.SenderConnectInfoList[i].SenderIndex == ScreenRealParams.ScreenLayer.CurrentSenderIndex) { for (int j = 0; j < screenLayer.SenderConnectInfoList[i].PortConnectInfoList.Count; j++) { if (screenLayer.SenderConnectInfoList[i].PortConnectInfoList[j].PortIndex == ScreenRealParams.ScreenLayer.CurrentPortIndex) { nextIndex = screenLayer.SenderConnectInfoList[i].PortConnectInfoList[j].MaxConnectIndex+1; } } } } return nextIndex; //int nextIndex = 0; //int curMaxIndex = -1; //ObservableCollection<IElement> portElementCollection = portLayer.ElementCollection; //for (int i = 0; i < portElementCollection.Count; i++) //{ // IElement element = portElementCollection[i]; // if (element is RectElement) // { // RectElement re = element as RectElement; // int connectedIndex = re.ConnectedIndex; // if (connectedIndex >= 0) // { // curMaxIndex = Math.Max(connectedIndex, curMaxIndex); // } // } //} //nextIndex = curMaxIndex + 1; //return nextIndex; }