public Console(IInput input, IViewer viewer) { Command = new Command(); _Filter = LogFilter.All; _Initial(input , viewer); }
/// <summary> /// Checks if any viewers have changed since last Update, and if so it updates the grid. /// </summary> /// <returns>Whether anything has changed.</returns> public bool Activity() { bool hasAnythingChanged = false; int xIndex; int yIndex; foreach (KeyValuePair <IViewer, ViewerInformation> kvp in this.mViewers) { IViewer viewer = kvp.Key; ViewerInformation information = kvp.Value; WorldToIndex(viewer.X, viewer.Y, out xIndex, out yIndex); int radiusAsInt = MathFunctions.RoundToInt(viewer.WorldViewRadius / mGridSpacing); if (xIndex != information.LastX || yIndex != information.LastY) { hasAnythingChanged = true; information.LastX = xIndex; information.LastY = yIndex; if (xIndex >= radiusAsInt && yIndex >= radiusAsInt && xIndex + radiusAsInt < mNumberOfXTiles && yIndex + radiusAsInt < mNumberOfYTiles) { UpdateViewersLocalVisibilityGrid(viewer, information); } } } if (hasAnythingChanged) { UpdateRevealedFromViewers(); } return(hasAnythingChanged); }
/// <summary> /// Adds an IViewer to this grid. /// </summary> /// <param name="viewerToAdd">The viewer to add.</param> public void AddViewer(IViewer viewerToAdd) { int localGridDimension = MathFunctions.RoundToInt(viewerToAdd.WorldViewRadius / mGridSpacing) * 2 + 1; VisibilityGrid localVisibilityGrid = new VisibilityGrid(0, 0, mGridSpacing, localGridDimension, localGridDimension); ViewerInformation viewerInformation = new ViewerInformation(); viewerInformation.LocalVisibilityGrid = localVisibilityGrid; if (mFogFactor > 0) { localVisibilityGrid.FogColor = FogColor; localVisibilityGrid.FogShade = FogShade; localVisibilityGrid.FogResolution = FogResolution; } int xIndex; int yIndex; mViewers.Add(viewerToAdd, viewerInformation); WorldToIndex(viewerToAdd.X, viewerToAdd.Y, out xIndex, out yIndex); int radiusAsInt = MathFunctions.RoundToInt(viewerToAdd.WorldViewRadius / mGridSpacing); if (xIndex >= radiusAsInt && yIndex >= radiusAsInt && xIndex + radiusAsInt < mNumberOfXTiles && yIndex + radiusAsInt < mNumberOfYTiles) { UpdateViewersLocalVisibilityGrid(viewerToAdd, viewerInformation); } UpdateRevealedFromViewers(); }
private void UpdateRevealedFromViewers() { MakeAllHidden(); int x; int y; int xIndex; int yIndex; int radiusAsInt; foreach (KeyValuePair <IViewer, ViewerInformation> kvp in mViewers) { IViewer viewer = kvp.Key; WorldToIndex(viewer.X, viewer.Y, out xIndex, out yIndex); radiusAsInt = MathFunctions.RoundToInt(viewer.WorldViewRadius / mGridSpacing); if (xIndex >= radiusAsInt && yIndex >= radiusAsInt && xIndex + radiusAsInt < mNumberOfXTiles && yIndex + radiusAsInt < mNumberOfYTiles) { ViewerInformation info = kvp.Value; VisibilityGrid gridToPlace = info.LocalVisibilityGrid; int xOffset = MathFunctions.RoundToInt((gridToPlace.mXSeed - mXSeed) / mGridSpacing); int yOffset = MathFunctions.RoundToInt((gridToPlace.mYSeed - mYSeed) / mGridSpacing); int fogX, fogY; Color sourceColor; Color destinationColor; for (x = 0; x < gridToPlace.mNumberOfXTiles; x++) { for (y = 0; y < gridToPlace.mNumberOfYTiles; y++) { mRevealedTiles[x + xOffset][y + yOffset] |= gridToPlace.mRevealedTiles[x][y]; if (mFogFactor > 0) { for (fogX = 0; fogX < mFogFactor; fogX++) { for (fogY = 0; fogY < mFogFactor; fogY++) { sourceColor = gridToPlace.mFogImageData.GetPixelColor(x * mFogFactor + fogX, y * mFogFactor + fogY); destinationColor = mFogImageData.GetPixelColor((x + xOffset) * mFogFactor + fogX, (y + yOffset) * mFogFactor + fogY); if (sourceColor.R > destinationColor.R) { destinationColor = sourceColor; } mFogImageData.SetPixel((x + xOffset) * mFogFactor + fogX, (y + yOffset) * mFogFactor + fogY, destinationColor); } } } } } } } if (mFogFactor > 0 && mFogTexture != null) { mFogImageData.ToTexture2D(mFogTexture); } }
public Console(IInput input, IViewer viewer) { Command = new Command(); _Filter = LogFilter.All; _Commands = new Dictionary <string, string>(); _Initial(input, viewer); }
private void BeginShowNewWindow(IViewer matchedPlugin, string path) { _viewWindow = new MainWindow(); _viewWindow.Closed += (sender2, e2) => { _viewWindow.Dispose(); _viewWindow = null; GC.Collect(); }; try { _viewWindow.BeginShow(matchedPlugin, path); } catch (Exception e) // if current plugin failed, switch to default one { Debug.WriteLine(e.ToString()); Debug.WriteLine(e.StackTrace); if (matchedPlugin.GetType() != PluginManager.GetInstance().DefaultPlugin) { matchedPlugin.Dispose(); _viewWindow.BeginShow(PluginManager.GetInstance().DefaultPlugin.CreateInstance <IViewer>(), path); } } }
/// <summary> /// Creates standard Far viewer ready for opening (F3) /// </summary> /// <param name="filePath">Existing file to view.</param> public static IViewer CreateViewer(string filePath) { IViewer view = Far.Api.CreateViewer(); view.FileName = filePath; return(view); }
static void EdgeSeparationTrackBarValueChanged(object sender, EventArgs e) { var edgeSeparationTruckBar = (TrackBar)sender; GViewer gviewer = GetGviewer(edgeSeparationTruckBar); Graph drawingGraph = gviewer.Graph; if (drawingGraph == null) { return; } EdgeRoutingSettings edgeRoutingSettings = drawingGraph.LayoutAlgorithmSettings.EdgeRoutingSettings; edgeRoutingSettings.EdgeRoutingMode = EdgeRoutingMode.SplineBundling; if (edgeRoutingSettings.BundlingSettings == null) { edgeRoutingSettings.BundlingSettings = new BundlingSettings(); } edgeRoutingSettings.BundlingSettings.EdgeSeparation = GetEdgeSeparation(edgeSeparationTruckBar); var br = new SplineRouter(drawingGraph.GeometryGraph, 1, 1, Math.PI / 6, edgeRoutingSettings.BundlingSettings); br.Run(); IViewer iv = gviewer; foreach (IViewerObject edge in iv.Entities) { if (edge is IViewerEdge) { iv.Invalidate(edge); } } }
unsafe void DockViewer_Load(object sender, EventArgs e) { try { viewer = new Viewer(); viewer.LoadEffectFunc += () => { StopViewer(); viewer.RemoveEffect(); Export(); IsChanged = false; return(true); }; IsPlaying = false; IsPaused = false; IsChanged = true; current = 0; Core.Viewer = viewer; } catch (Exception exception) { MessageBox.Show("描画画面の生成に失敗しました。DirectXのバージョンの問題、メモリの不足等が考えられます。"); throw exception; } }
public Console(IInput input, IViewer viewer) { Command = new Command(); _Filter = LogFilter.All; _Commands = new Dictionary<string, string>(); _Initial(input, viewer); }
private byte CalculateFogColorByDistance(float x, float y, byte alpha, IViewer viewer) { int shadeValue = 127;// alpha; int radiusAsInt; int radiusAsIntSquared; //We need to extend the radius slightly to allow smooth gradients on grid squares just out side the viewable area. int radiusExtended; int radiusExtendedSquared; float xIndex; float yIndex; float distance; float calculatedValue; { radiusAsInt = MathFunctions.RoundToInt(viewer.WorldViewRadius / mGridSpacing); radiusExtended = radiusAsInt + 2; radiusAsIntSquared = radiusAsInt * radiusAsInt; radiusExtendedSquared = radiusExtended * radiusExtended; WorldToIndex(viewer.X, viewer.Y, out xIndex, out yIndex); distance = ((x - xIndex) * (x - xIndex)) + ((y - yIndex) * (y - yIndex)); if (distance <= radiusAsIntSquared) { calculatedValue = distance / radiusAsIntSquared; calculatedValue = MathHelper.Max(0, MathHelper.Min((calculatedValue /** calculatedValue*/), 1.0f)); shadeValue = (byte)((1.0f - calculatedValue) * 127); alpha = (byte)MathHelper.Min(MathHelper.Max(alpha, shadeValue), 127); } } return(alpha); }
public SceneManager(ILog log, ISceneManagerSettings settings, IViewer viewer) { this.log = log; this.settings = settings; this.viewer = viewer; Init(); }
public XtraTabControl InitiaizeRelatedViewer(IViewer editorViewer, int pageIndex) { _tabControl = _CommonTabControl.InitializeCommonTabControl((Control)editorViewer, editorViewer.HeaderTitle, pageIndex, true, true, (ViewerName)editorViewer.ViewerID); return(_tabControl); }
/// <summary> /// Removes a viewer. /// </summary> /// <param name="viewerToRemove">The argument IViewer to remove.</param> public void RemoveViewer(IViewer viewerToRemove) { mViewers.Remove(viewerToRemove); // This have definitely changed, so we gotta refresh everything. // Fortunately there's no re-calculation here, just paste everything // down. The newly-removed guy will not be placed. UpdateRevealedFromViewers(); }
public void OpenVideoViewer(ViewerType viewerType, bool showWaitingInfo) { if (this.InvokeRequired) { this.Invoke(new CbGeneric <ViewerType, bool>(this.OpenVideoViewer), viewerType, showWaitingInfo); } else { this.haveCloseVedio = false; TabPage page; if (this.tabControl1.TabPages.Count == 0) { page = new TabPage("视频"); this.tabControl1.TabPages.Add(page); } else { page = this.tabControl1.TabPages[0]; (page.Controls[0] as IViewer).Close(); page.Controls.Clear(); this.Width = this.Width - this.panel_plus.Width; } switch (viewerType) { case ViewerType.VideoRequest: { VideoRequestViewer videoRequestViewer = new VideoRequestViewer(); videoRequestViewer.Dock = System.Windows.Forms.DockStyle.Fill; videoRequestViewer.ReceiveVideo += new CbGeneric(videoRequestViewer_ReceiveVideo); videoRequestViewer.RejectVideo += new CbGeneric(videoRequestViewer_RejectVideo); page.Controls.Add(videoRequestViewer); this.currentViewer = videoRequestViewer; this.panel_plus.Visible = true; int screenWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; this.Width = this.Width + 224 > screenWidth ? screenWidth : this.Width + 224; this.panel_plus.Width = 224; break; } case ViewerType.VideoView: { videoViewer = new VideoViewer(userName, friendName, showWaitingInfo, this.multimediaManager); videoViewer.CloseVideo += new CbGeneric(videoViewer_CloseVideo); videoViewer.OfflineCloseVideo += new CbGeneric(videoViewer_OfflineCloseVideo); page.Controls.Add(videoViewer); this.panel_plus.Visible = true; int screenWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; this.Width = this.Width + 346 > screenWidth ? screenWidth : this.Width + 346; this.panel_plus.Width = 346; this.currentViewer = videoViewer; break; } } this.haveVideo = true; } }
public App( IGitHubClient gitHubClient, IViewer viewer, IMapper mapper ) { _gitHubClient = gitHubClient; _viewer = viewer; _mapper = mapper; }
void MoveVertical(Point pos, int ydir) { CharacterHandler handler = Handler as CharacterHandler; IViewer viewer = handler.Viewer; if (viewer != null) { Canvas canvas = handler.CurrentPage.Canvas; BitFont font = handler.CurrentPage.Font; Point newCursor = pos; float fontHeight = ((float)font.Height) * handler.ZoomRatio.Height; int verticalOffset = (int)((viewer.ViewSize.Height + fontHeight - 1) / fontHeight); newCursor.Y += verticalOffset * ydir; if (newCursor.Y > canvas.Height - 1) { newCursor.Y = canvas.Height - 1; } if (newCursor.Y < 0) { newCursor.Y = 0; } //Rectangle rect = handler.SelectedRegion; handler.CursorPosition = newCursor; /*handler.SetCursorPosition(newCursor, false); * handler.InvalidateCharacterRegion(new Rectangle(pos, new Size(1,1))); * rect.Normalize(); * rect.Width++; * rect.Height++; * * handler.InvalidateCharacterRegion(rect); */ Point scrollPos = viewer.ScrollPosition; scrollPos.Y += (int)Math.Round(verticalOffset * fontHeight) * ydir; if (scrollPos.Y < 0) { scrollPos.Y = 0; } viewer.ScrollPosition = scrollPos; /* * handler.InvalidateCharacterRegion(new Rectangle(newCursor, new Size(1,1))); * rect = handler.SelectedRegion; * rect.Normalize(); * rect.Width++; * rect.Height++; * * handler.InvalidateCharacterRegion(rect); */ } }
private void _Initial(IInput input, IViewer viewer) { _Viewer = viewer; _Input = input; _Input.OutputEvent += _Run; Command.RegisterEvent += _OnRegister; Command.UnregisterEvent += _OnUnregister; Command.Register("help", _Help); }
public static void Hide(IViewer viewer) { List <HexCell> cells = GetVisibleCells(viewer); for (int i = 0; i < cells.Count; i++) { cells[i].DecreaseVisibility(); } m_listPool.Restore(cells); }
/// Launches net poisoning process until all computers are not poisoned. public static ulong MainProcess(IReader reader, IViewer viewer) { var input = reader.ReadFromFile(); var net = new Net(input.adjacencyMatrix, input.computers); ulong iteration = 0; while (!Logic.Iteration(net)) { viewer.View(net, iteration++); } viewer.View(net, iteration++); return iteration; }
internal void BeginShow(IViewer matchedPlugin, string path, Action <string, ExceptionDispatchInfo> exceptionHandler) { _path = path; Plugin = matchedPlugin; ContextObject.ViewerWindow = this; // get window size before showing it try { Plugin.Prepare(path, ContextObject); } catch (Exception e) { exceptionHandler(path, ExceptionDispatchInfo.Capture(e)); } SetOpenWithButtonAndPath(); // revert UI changes ContextObject.IsBusy = true; var margin = windowFrameContainer.Margin.Top * 2; var newHeight = ContextObject.PreferredSize.Height + margin + (ContextObject.TitlebarOverlap ? 0 : windowCaptionContainer.Height); var newWidth = ContextObject.PreferredSize.Width + margin; ResizeAndCenter(this, new Size(newWidth, newHeight), _canOldPluginResize, ContextObject.CanResize); if (Visibility != Visibility.Visible) { Show(); } ShowWindowCaptionContainer(null, null); //WindowHelper.SetActivate(new WindowInteropHelper(this), ContextObject.CanFocus); // load plugin, do not block UI Dispatcher.BeginInvoke(new Action(() => { try { Plugin.View(path, ContextObject); } catch (Exception e) { exceptionHandler(path, ExceptionDispatchInfo.Capture(e)); } }), DispatcherPriority.Input); }
public ItemController(IViewer view) : base(view) { ParseFunc = new Func <List <string[]>, List <Item> >((c) => (new EntityParser(UserId).ParseToItems(c))); InsertAction = new Func <List <Item>, int>((e) => { using (var context = new InventoryDbEntities()) { context.Items.AddRange(e); return(context.SaveChanges()); } }); }
private void GenerujTaby(TabsWidget widgetBase, NsPanel panelRodzic, IViewer viewer, bool isPostBack) { var tabs = NsTabs.UtworzTabs(widgetBase); panelRodzic.Controls.Add(tabs.Panel); foreach (var widgetBaseTab in widgetBase.Tabs) { var tab = NsPanel.UtworzPanel(widgetBaseTab); GenerujElementy(widgetBaseTab, tab, viewer, isPostBack); tabs.AddTab(tab); } }
public void UnsafeView(IntPtr dataPtr, Type type) { #if UNITY_EDITOR TypeName = type.ToReadableName(); var viewerFactory = _register.FindFactory(type); if (Viewer == null || Viewer.GetType() != viewerFactory.Type) { Viewer = (IViewer)viewerFactory.Create(); } Viewer.View(dataPtr, type, _register); #endif }
internal void BeginShow(IViewer matchedPlugin, string path) { ContextObject.CurrentContentContainer = viewContentContainer; ContextObject.ViewerPlugin = matchedPlugin; // get window size before showing it matchedPlugin.BoundViewSize(path, ContextObject); Show(); matchedPlugin.View(path, ContextObject); }
/// Launches net poisoning process until all computers are not poisoned. public static ulong MainProcess(IReader reader, IViewer viewer) { var input = reader.ReadFromFile(); var net = new Net(input.adjacencyMatrix, input.computers); ulong iteration = 0; while (!Logic.Iteration(net)) { viewer.View(net, iteration++); } viewer.View(net, iteration++); return(iteration); }
public PermissionController(IViewer view) : base(view) { ParseFunc = new Func <List <string[]>, List <TransactionPermission> >((c) => (new EntityParser(UserId).ParseToPermission(c))); InsertAction = new Func <List <TransactionPermission>, int>((e) => { using (var context = new InventoryDbEntities()) { context.TransactionPermissions.AddRange(e); return(context.SaveChanges()); } }); }
protected override void ProcessRecord() { IViewer viewer = CreateViewer(); if (Modal) { viewer.Open(OpenMode.Modal); } else { viewer.Open(); } }
public void Initialize(PluginConfiguration configuration, Action <Action <ISystemController, IRaceController> > queueCommand) { try { _viewer = new WebViewer(_logger, queueCommand, this, _kernel); configuration.DashboardViewers.Add(_viewer); } catch (Exception ex) { _viewer = null; _logger.Error("Failed to initialize onboard web ui", ex); } }
protected void GenerujElementy(WidgetBase widgetBase, NsPanel panelRodzic, IViewer viewer, bool isPostBack) { if (widgetBase is Action) { var akcja = widgetBase as Action; var a = UtworzAkcja(akcja, viewer); panelRodzic.Controls.Add(a); } else if (widgetBase is Panel) { var oPanel = widgetBase as Panel; var panel = NsPanel.UtworzPanel(oPanel); panelRodzic.Controls.Add(panel); foreach (var element in oPanel.Elementy) { GenerujElementy(element, panel, viewer, isPostBack); } } else if (widgetBase is TabsWidget) { GenerujTaby((TabsWidget)widgetBase, panelRodzic, viewer, isPostBack); } else { //mamy kontrolkę - generują ją if (widgetBase.Label != null) { var label = UtworzLabel(widgetBase.Name); label.Style["display"] = "block"; label.Width = new Unit("99%"); label.ToolTip = widgetBase.ToolTip; panelRodzic.Controls.Add(label); } var kontrolka = GenerujKontrolke(widgetBase, panelRodzic, viewer, isPostBack); var kont = kontrolka as WebControl; if (kont != null) { kont.Style["display"] = "block"; kont.Width = new Unit("99%"); kont.Style[HtmlTextWriterStyle.MarginBottom] = "10px"; } panelRodzic.Controls.Add(kontrolka); } }
internal IViewer CreateViewer() { IViewer viewer = Far.Api.CreateViewer(); viewer.DeleteSource = DeleteSource; viewer.DisableHistory = DisableHistory; viewer.FileName = GetUnresolvedProviderPathFromPSPath(Path); viewer.Switching = Switching; viewer.Title = Title; if (CodePage >= 0) { viewer.CodePage = CodePage; } return(viewer); }
public ConsoleController(string instruction, IContinueChecker checkerProcess, INumbericsValidator numbericsCheker, IFigureValidator figuresChecker, TriangleFactory figureBuilder, IComparer <IFigure> figuresComparer, FiguresSorterByDescendingFactory sorterFactory, IViewer figuresViwer) { _insrtuction = instruction; _checker = checkerProcess; _numbericsCheker = numbericsCheker; _figuresChecker = figuresChecker; _figureBuilder = figureBuilder; _figuresComparer = figuresComparer; _sorterFactory = sorterFactory; _figuresViwer = figuresViwer; _figuresContainer = new Queue <IFigure>(); }
public void InitializeCollector(IViewer viewer, ViewerName viewerName) { if (ActiveCollector == null) { ActiveCollector = (AbstractDataCollector <TEntity>)DataCollectorFactory.GetDataCollectorFactory <TEntity>(viewerName); } if (ActiveCollector != null) { ActiveCollector.ActiveViewer = viewer; } ActiveViewerName = viewerName; Collect(ActiveCollector); }
/// <summary> /// Constructor /// </summary> /// <param name="viewerPar">the viewer that the editor communicates with</param> public LayoutEditor(IViewer viewerPar) { viewer = viewerPar; HookUpToViewerEvents(); ToggleEntityPredicate = (modifierKeys, mouseButtons, draggingParameter) => LeftButtonIsPressed(mouseButtons); NodeInsertPredicate = (modifierKeys, mouseButtons, draggingParameter) => MiddleButtonIsPressed(mouseButtons) && draggingParameter == false; DecorateObjectForDragging = TheDefaultObjectDecorator; RemoveObjDraggingDecorations = TheDefaultObjectDecoratorRemover; DecorateEdgeForDragging = TheDefaultEdgeDecoratorStub; DecorateEdgeLabelForDragging = TheDefaultEdgeLabelDecoratorStub; RemoveEdgeDraggingDecorations = TheDefaultEdgeDecoratorStub; geomGraphEditor.ChangeInUndoRedoList += LayoutEditorChangeInUndoRedoList; }
/// <summary> /// Returns whether a given world position is in view of a given viewer. /// </summary> /// <param name="viewer">The viewer to check visibility for.</param> /// <param name="targetPosition">The world coordinates.</param> /// <returns>Whether in view.</returns> public bool IsPositionInDirectView(IViewer viewer, ref Vector3 targetPosition) { if (mViewers.ContainsKey(viewer)) { VisibilityGrid grid = mViewers[viewer].LocalVisibilityGrid; return grid.IsRevealedWorld(targetPosition.X, targetPosition.Y); } #if DEBUG else { throw new InvalidOperationException("Viewer does not exist in Visbility grid"); } #else return false; #endif }
private void UpdateViewersLocalVisibilityGrid(IViewer viewer, ViewerInformation viewerInformation) { VisibilityGrid localGrid = viewerInformation.LocalVisibilityGrid; localGrid.MakeAllHidden(); localGrid.ClearBlockedTiles(); int viewRadius = MathFunctions.RoundToInt(viewer.WorldViewRadius / mGridSpacing); int xIndex; int yIndex; WorldToIndex(viewer.X, viewer.Y, out xIndex, out yIndex); float tileCenteredXPosition; float tileCenteredYPosition; IndexToWorld(xIndex, yIndex, out tileCenteredXPosition, out tileCenteredYPosition); viewerInformation.LastX = xIndex; viewerInformation.LastY = yIndex; localGrid.mXSeed = tileCenteredXPosition - viewer.WorldViewRadius; localGrid.mYSeed = tileCenteredYPosition - viewer.WorldViewRadius; int xOffset = MathFunctions.RoundToInt((localGrid.mXSeed - mXSeed) / mGridSpacing); int yOffset = MathFunctions.RoundToInt((localGrid.mYSeed - mYSeed) / mGridSpacing); // copy over the blocked areas to the viewer int y; int fogX, fogY; byte shadedValue; Color shadedColor; float invertedFogFactor = 1.0f; if (mFogFactor > 1) invertedFogFactor = 1.0f / mFogFactor; for (int x = 0; x < localGrid.mNumberOfXTiles; x++) { for (y = 0; y < localGrid.mNumberOfYTiles; y++) { localGrid.mBlockedTiles[x][y] = mBlockedTiles[x + xOffset][y + yOffset]; } } localGrid.MakeAllHidden(); localGrid.RevealCircle(viewRadius, viewRadius, viewRadius); localGrid.BleedDirectlyVisibleToWalls(); if (mFogFactor > 0) { for (int x = 0; x < localGrid.mNumberOfXTiles; x++) { for (y = 0; y < localGrid.mNumberOfYTiles; y++) { for (fogX = 0; fogX < mFogFactor; fogX++) { for (fogY = 0; fogY < mFogFactor; fogY++) { shadedColor = localGrid.mFogImageData.GetPixelColor(x * mFogFactor + fogX, y * mFogFactor + fogY); shadedValue = 0; if (localGrid.mRevealedTiles[x][y] != 0) shadedValue = localGrid.CalculateFogColorByDistance(x + (fogX * invertedFogFactor), y + (fogY * invertedFogFactor), shadedColor.R, viewer); else if (shadedColor.R > FogShade) shadedValue = FogShade; #if XNA4 //shadedColor = Color.FromNonPremultiplied(FogColor.R, FogColor.G, FogColor.B, shadedValue); shadedColor = Color.FromNonPremultiplied(shadedValue, shadedValue, shadedValue, 255); #else shadedColor = FogColor; shadedColor.A = shadedValue; #endif localGrid.mFogImageData.SetPixel(x * mFogFactor + fogX, y * mFogFactor + fogY, shadedColor); } } } } } }
private byte CalculateFogColorByDistance(float x, float y, byte alpha, IViewer viewer) { int shadeValue = 127;// alpha; int radiusAsInt; int radiusAsIntSquared; //We need to extend the radius slightly to allow smooth gradients on grid squares just out side the viewable area. int radiusExtended; int radiusExtendedSquared; float xIndex; float yIndex; float distance; float calculatedValue; { radiusAsInt = MathFunctions.RoundToInt(viewer.WorldViewRadius / mGridSpacing); radiusExtended = radiusAsInt + 2; radiusAsIntSquared = radiusAsInt * radiusAsInt; radiusExtendedSquared = radiusExtended * radiusExtended; WorldToIndex(viewer.X, viewer.Y, out xIndex, out yIndex); distance = ((x - xIndex) * (x - xIndex)) + ((y - yIndex) * (y - yIndex)); if (distance <= radiusAsIntSquared) { calculatedValue = distance / radiusAsIntSquared; calculatedValue = MathHelper.Max(0, MathHelper.Min( (calculatedValue /** calculatedValue*/), 1.0f)); shadeValue = (byte)((1.0f-calculatedValue) * 127); alpha = (byte)MathHelper.Min(MathHelper.Max(alpha, shadeValue), 127); } } return alpha; }
internal RemoveNodeUndoAction(IViewer viewer, IViewerNode node) :base(viewer.ViewerGraph.DrawingGraph.GeometryGraph){ this.viewer = viewer; this.removedNode = node; this.GraphBoundingBoxAfter = viewer.ViewerGraph.DrawingGraph.BoundingBox; //do not change the bounding box }
unsafe void DockViewer_Load(object sender, EventArgs e) { try { viewer = new Viewer(); viewer.LoadEffectFunc += () => { StopViewer(); viewer.RemoveEffect(); Export(); IsChanged = false; return true; }; IsPlaying = false; IsPaused = false; IsChanged = true; current = 0; Core.Viewer = viewer; } catch(Exception exception) { MessageBox.Show("描画画面の生成に失敗しました。DirectXのバージョンの問題、メモリの不足等が考えられます。"); throw exception; } }
///<summary> ///</summary> public static void RouteEdgesRectilinearly(IViewer viewer) { var geomGraph = viewer.Graph.GeometryGraph; var settings = viewer.Graph.LayoutAlgorithmSettings; RectilinearInteractiveEditor.CreatePortsAndRouteEdges(settings.NodeSeparation / 3, 1, geomGraph.Nodes, geomGraph.Edges, settings.EdgeRoutingSettings.EdgeRoutingMode, true, settings.EdgeRoutingSettings.UseObstacleRectangles, settings.EdgeRoutingSettings.BendPenalty); var labelPlacer = new EdgeLabelPlacement(geomGraph); labelPlacer.Run(); }
internal RemoveEdgeUndoAction(Graph graph, IViewer viewer, IViewerEdge edge) :base(graph.GeometryGraph){ this.viewer = viewer; this.removedEdge = edge; this.GraphBoundingBoxAfter = graph.BoundingBox; //do not change the bounding box }
internal AddEdgeUndoAction(IViewer viewer, IViewerEdge edge) :base(viewer.ViewerGraph.DrawingGraph.GeometryGraph){ this.viewer = viewer; this.addedEdge = edge; }
internal AddNodeUndoAction(Graph graph, IViewer viewer, IViewerNode node) :base(graph.GeometryGraph){ this.viewer = viewer; this.addedNode = node; }
public void AddViewer(IViewer viewer) { this._uc.AddControl(viewer.UC); }