private void Window_Loaded(object sender, RoutedEventArgs e) { spark = (SparkWindow)this.Owner; if (graphSetting == null) { graphSetting = spark.settingCommon.graphSetting; } DirectoryInfo folder = new DirectoryInfo(Core.Work.EnvPath); FileInfo[] files = folder.GetFiles("*.sqlite"); string[] filesName = new string[files.Length]; for (int i = 0; i < files.Length; i++) { filesName[i] = Path.GetFileNameWithoutExtension(files[i].FullName); } lbDataBases.ItemsSource = filesName; timerEmul.Elapsed += TimerEmul_Elapsed; var controller = new PlotController(); controller.UnbindAll(); controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt); controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Control, PlotCommands.ZoomRectangle); controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Alt, PlotCommands.PointsOnlyTrack); controller.BindMouseWheel(PlotCommands.ZoomWheel); controller.BindKeyDown(OxyKey.R, PlotCommands.Reset); plotter.Controller = controller; }
/// <summary> /// 刷新图元绘制参数 /// </summary> public override void Refresh() { // 初始化绘图数据管理对象 graphSetting = GraphSetting.GetGraphSetting(); // 刷新逻辑数据 textRectangle.Location = location; textRectangle.Size = elementSize; }
public SettingGraphsWindow(GraphSetting graphSetting) { InitializeComponent(); this.graphSettingReturn = graphSetting; this.graphSetting = graphSetting.Clone(); graphParamsSet.Visibility = Visibility.Collapsed; this.Height = 275; this.Title = "Настройки для графиков"; InitGraphSets(); }
/// <summary> /// 刷新图元绘制参数 /// </summary> public override void Refresh() { // 初始化绘图数据管理对象 graphSetting = GraphSetting.GetGraphSetting(); textRectangle.Location = location; textRectangle.Size = elementSize; RefreshImages(); }
/// <summary> /// 刷新图元绘制参数 /// </summary> public override void Refresh() { // 初始化绘图数据管理对象 graphSetting = GraphSetting.GetGraphSetting(); // 刷新逻辑数据 textRectangle.Location = location + new Size(-(int)(elementSize.Width / 2), -(int)(elementSize.Height / 2)); textRectangle.Size = elementSize; activateRectangle.Location = location + new Size(-elementSize.Width, -elementSize.Height); activateRectangle.Size = elementSize + elementSize; }
private void OnEnable() { settingAsset = (GraphSetting)target; foreach (var item in ReflectionHelper.GetChildTypes <InternalGraphGroupAsset>()) { if (item.IsAbstract) { continue; } if (settingAsset.GetSearchPath(item.FullName) == null) { settingAsset.groupPaths.Add(new GraphGroupPath(item)); } } }
public SettingGraphsWindow(GraphSetting graphSetting, ObservableCollection <CheckedParam> selectedParams) { InitializeComponent(); this.selectedParams = selectedParams; this.graphSettingReturn = graphSetting; this.graphSetting = graphSetting.Clone(); paramsList = new ObservableCollection <DataParamGraphSetting>(); foreach (CheckedParam selectedParam in selectedParams) { paramsList.Add(new DataParamGraphSetting { Title = selectedParam.Title, ColorLine = selectedParam.ColorLine, IsRight = selectedParam.IsRight, MinY = selectedParam.MinY, MaxY = selectedParam.MaxY }); } graphParamsSet.ItemsSource = paramsList; InitGraphSets(); }
/// <summary> /// 刷新图元绘制参数 /// </summary> public override void Refresh() { // 初始化绘图数据管理对象 graphSetting = GraphSetting.GetGraphSetting(); // 刷新表现文本 displayText = text; // 刷新逻辑数据 textBorderWidth = 20; textMargin = 16; AdjustRectangle(); AdjustText(); // 刷新连接线控制点 foreach (ConnectorGraphElement connector in connectorList) { connector.Refresh(); } }
/// <summary> /// 执行命令 /// </summary> /// <param name="o">当前对象</param> /// <returns>是否执行成功</returns> public override bool Execute(object o) { bool success = true; object[] args = o as object[]; int id = graphManager.AllocateGraphElementID(); Point p = (Point)args[0]; string typeString = args[1] as string; GraphSetting graphSetting = GraphSetting.GetGraphSetting(); // 保存命令执行前的数据 if (firstCommand) // 只有第一条命令保存执行前的数据 { SaveBeforeExecute(flowChartManager.GetArguments()); } switch (typeString) { case "ConditionNode": // 条件结点 { ConditionGraphElement conditionGraphElement = new ConditionGraphElement(p, graphSetting.ConditionNodeElementSize); InitSlotContainer(conditionGraphElement, id, "条件结点"); break; } case "ActionNode": // 动作结点 { ActionGraphElement actionGraphElement = new ActionGraphElement(p, graphSetting.ActionNodeElementSize); InitSlotContainer(actionGraphElement, id, "动作结点"); break; } case "EventNode": // 事件结点 { EventGraphElement eventGraphElement = new EventGraphElement(p, graphSetting.EventNodeElementSize); InitSlotContainer(eventGraphElement, id, "事件结点"); break; } case "AIStateNode": // ai状态结点 { AIStateGraphElement aiStateGraphElement = new AIStateGraphElement(p, graphSetting.AIStateNodeElementSize); InitSlotContainer(aiStateGraphElement, id, "AI状态结点"); break; } case "AIActionNode": // ai动作结点 { AIActionGraphElement aiActionGraphElement = new AIActionGraphElement(p, graphSetting.AIActionNodeElementSize); InitSlotContainer(aiActionGraphElement, id, "AI动作结点"); break; } case "AIActionsNode": // ai动作组结点 { AIActionsGraphElement aiActionsGraphElement = new AIActionsGraphElement(p, graphSetting.AIActionsNodeElementSize); InitSlotContainer(aiActionsGraphElement, id, "AI动作组结点"); break; } case "InnerChart": // 子绘图结点 { InnerChart innerChart = new InnerChart(p, graphSetting.InnerChartElementSize); InitSlotContainer(innerChart, id, "子绘图结点"); break; } case "InterfaceNode": // 接口结点 { InterfaceGraphElement interfaceGraphElement = new InterfaceGraphElement(p, graphSetting.InterfaceNodeElementSize); InitSlotContainer(interfaceGraphElement, id, "接口结点"); break; } } if (success) // 保存命令执行后的数据 { flowChartManager.ContentChanged = true; SaveAfterExecute(flowChartManager.GetArguments()); } return(success); }
/// <summary> /// 初始化绘图参数 /// </summary> protected virtual void InitGraphSetting() { GraphSetting graphSetting = GraphSetting.GetGraphSetting(); graphSetting.GraphElementTextColor = Color.Black; }
public static Noeud[] GenerateGraph(GraphSetting setting) { nodes = new List <Noeud>(); gridWidth = Random.Range(setting.gridWidth.x, setting.gridWidth.y + 1); gridHeight = Random.Range(setting.gridHeight.x, setting.gridHeight.y + 1); grid = new int[gridWidth, gridHeight]; //Create Root Node Vector2Int pos = new Vector2Int(gridWidth / 2, gridHeight / 2); Noeud rootNode = new Noeud(pos, Noeud.TYPE_DE_NOEUD.START); //rootNode.liens.Add(1, Noeud.TYPE_DE_LIEN.OPEN); // Create new node grid[pos.x, pos.y] = 0; nodes.Add(rootNode); //Critical Path Generation criticalpathLength = Random.Range(setting.criticalPathLength.x, setting.criticalPathLength.y + 1); bool result = GeneratePath(0, criticalpathLength - 1); if (!result) { return(null); } nodes[nodes.Count - 1].type = Noeud.TYPE_DE_NOEUD.END; bool obstacles = GenerateObstacles( Random.Range(setting.obstacleCount.x, setting.obstacleCount.y + 1), Random.Range(setting.secondaryPathLength.x, setting.secondaryPathLength.y + 1)); if (!obstacles) { return(null); } switch (setting.secretRoomPositionningMode) { case GraphSetting.SecretRoomPositionningMode.MostNeighbour: GenerateSecretNodeMostNeighbour(Random.Range(setting.secretNode.x, setting.secretNode.y + 1)); break; case GraphSetting.SecretRoomPositionningMode.NextToLastKey: bool resultGeneration = GenerateSecretNodeNextToLastKey(); if (!resultGeneration) { return(null); } break; default: break; } //Set graph at origin for (int i = 1; i < nodes.Count; i++) { nodes[i].position = nodes[i].position - nodes[0].position; } nodes[0].position = Vector2Int.zero; return(nodes.ToArray()); }
/// <summary> /// 初始化绘图参数 /// </summary> protected override void InitGraphSetting() { GraphSetting graphSetting = GraphSetting.GetGraphSetting(); graphSetting.GraphElementTextColor = Color.Yellow; }
/// <summary> /// 刷新图元绘制参数 /// </summary> public override void Refresh() { // 初始化绘图数据管理对象 graphSetting = GraphSetting.GetGraphSetting(); // 刷新表现文本 displayText = text; // 刷新逻辑数据 textRectangle.Location = location; textRectangle.Size = elementSize; shadowRectangle.Location = location + new Size(4, 4); shadowRectangle.Size = elementSize; invalidRectangle = new Rectangle(location + new Size(-10, -10), elementSize + new Size(20, 45)); inSlotCount = inSlotList.Count; outSlotCount = outSlotList.Count; requireEvent = true; // 刷新图片 RefreshImages(); // 刷新插槽 foreach(SlotGraphElement slot in slotList) { slot.Refresh(); } // 重设插槽优先级 ResetSlotProperty(inSlotList); ResetSlotProperty(outSlotList); // 刷新按钮 foreach(ButtonGraphElement.BaseButton button in buttonList) { button.Refresh(); } // 刷新缩放控制点 foreach(ResizeControler resizeControler in resizeControlerList) { resizeControler.Refresh(); } // 刷新注释结点 if(remarkNode != null) { remarkNode.Refresh(); } }
public CustomerMatchController(IOptions <GraphSetting> graphSetting, IOptions <ClientSetting> clientSetting) { _graphSetting = graphSetting.Options; _clientSetting = clientSetting.Options; }
/// <summary> /// 绘图板鼠标滚动事件响应 /// </summary> /// <param name="sender">事件发送者</param> /// <param name="e">事件</param> private void canvas_MouseWheel(object sender, MouseEventArgs e) { if (graphManager.ControlMode) // 绘图板缩放 { return; // Control键的响应有问题,暂时屏蔽掉 graphManager.CurrentCanvas.AutoScroll = false; if (e.Delta > 0) { graphManager.AdjustCanvasScale(1.1f); } else { graphManager.AdjustCanvasScale(0.9f); } DocumentManager.GetDocumentManager().RefreshCanvasScaleDisplay(); } else { if (graphManager.ShiftMode) // 按shift键时横向滚动 { graphManager.CurrentCanvas.Visible = false; Size moveSize = new Size(-e.Delta, e.Delta); // 垂直方向反向滚动一次 moveSize.Width = (int)((double)moveSize.Width * graphManager.CurrentBackground.CanvasSize.Width / graphManager.CurrentCanvas.ClientSize.Width * GraphSetting.GetGraphSetting().CanvasScale); // 滚动条的单位与绘图板单位需要转换 moveSize.Height = (int)((double)moveSize.Height * graphManager.CurrentBackground.CanvasSize.Height / graphManager.CurrentCanvas.ClientSize.Height * GraphSetting.GetGraphSetting().CanvasScale); // 滚动条的单位与绘图板单位需要转换 graphManager.ScrollCanvas(moveSize, false); graphManager.CurrentCanvas.Visible = true; graphManager.CurrentCanvas.Focus(); } graphManager.CurrentCanvas.Refresh(); } }