static SMapWorkRequest CreateWorkRequestForApprox(int jobId) { CanvasSize canvasSize = new CanvasSize(1500, 1000); string sx = "-7.77919999999999943236517196964994e-01"; string ex = "7.50666666666666623738043047827275e-01"; string sy = "8.90133333333333821328163063905458e-02"; string ey = "1.07306666666666713248664185205901e-01"; SCoords coords = new SCoords( new SPoint(sx, sy), new SPoint(ex, ey) ); MapSection area = new MapSection(new Point(0, 0), canvasSize.GetWholeUnits(Engine.BLOCK_SIZE)); int maxIterations = 2000; string connectionId = "dummy"; SMapWorkRequest mapWorkRequest = new SMapWorkRequest("FEngRunner", coords, canvasSize, area, maxIterations, connectionId) { JobId = jobId }; return(mapWorkRequest); }
public MapWorkingData(CanvasSize canvasSize, MapInfo mapInfo, ColorMap colorMap) { CanvasSize = canvasSize; MapInfo = mapInfo; ColorMap = colorMap; if (mapInfo == null) { return; } //_xVals = BuildVals(CanvasSize.Width, MapInfo.LeftBot.X, MapInfo.RightTop.X); //// Build the y values from top to bottom //if(MapInfo.Coords.IsUpsideDown) //{ // // The values are already reversed go from bot to top. // _yVals = BuildVals(CanvasSize.Height, MapInfo.LeftBot.Y, MapInfo.RightTop.Y); //} //else //{ // // Go from top to bot. // _yVals = BuildVals(CanvasSize.Height, MapInfo.RightTop.Y, MapInfo.LeftBot.Y); //} _mPointWork = new MPointWork(mapInfo.MaxIterations); //System.Diagnostics.Debug.WriteLine($"The aspect ratio (w/h) is {MapInfo.AspectRatio}."); }
static SCoordsWorkRequest GetTransformWorkRequest(int jobId, SCoords curCoords, TransformType transformType, int amount) { CanvasSize samplePoints = new CanvasSize(0, 0); MapSection mapSection = new MapSection(new Point(amount, 0), new CanvasSize(0, 0)); SCoordsWorkRequest result = new SCoordsWorkRequest(transformType, curCoords, samplePoints, mapSection, jobId); return(result); }
//A start method that determines the borders where the advertisements are going to spawn between, using the CanvasSize script. private void Start() { CanvasSize canvasSize = canvas.GetComponent <CanvasSize>(); leftBorder = canvasSize.position.x - (canvasSize.width / 2); rightBorder = canvasSize.position.x + (canvasSize.width / 4); topBorder = canvasSize.position.y + (canvasSize.height / 2); botBorder = canvasSize.position.y - (canvasSize.height / 2); }
/// <summary> /// Initializes a new instance of the <see cref="IdpGie.Core.ProgramManager"/> class. /// </summary> public ProgramManager() { this.Time = 0.0d; this.Port = 8080; this.options = new OptionSet() { { "a|asp=", "Feed the system an .asp file in order to convert an idp model into drawing instructions.", x => this.AspFile = x }, { "i|idp=", "Feed the system an .idp file. The program must be given an .asp file as well in order to paint something.", x => this.IdpFile = x }, { "d|idpd=", "Feed the system a .idpd file. Limited interactive mode is enabled.", x => this.IdpdFile = x }, { "H|idph=", "Feed the system a .idph file that contains the defined hooks.", x => this.HookFile = x }, { "t|theory=", "The theory to use in the .idp file, only for interactive mode.", x => this.Theory = x }, { "s|structure=", "The structure to use in the .idp file, only for interactive mode.", x => this.Structure = x }, { "v|vocabulary=", "The vocabulary to use in the .idp file, only for interactive mode.", x => this.Vocabulary = x }, { "o|output=", "The output file (to store for instance LaTeX files).", x => this.OutputFile = x }, { "T|time=", "The timeframe of the model to plot (interactive sessions will ignore this argument).", x => this.Time = double.Parse(x) }, { "m|mode=", "The output mode (cairo, latex, ...).", x => this.OutputMode = x }, { "h|?|help", "Show this help manual and exit.", x => this.ShowHelp = (x != null) }, { "list-devices", "List the output devices together with a description.", x => this.ListDevices = (x != null) }, { "list-paints", "List the paint predicates together with a description.", x => this.ListPaints = (x != null) }, { "list-hooks", "List the hooks that can be handled together with a description.", x => this.ListHooks = (x != null) }, { "canvas-size=", "The size of the document (for instance the size of the resulting pdf).", x => this.CanvasSize = CanvasSize.Parse(x) }, { "g|geometry=", "The geometry of the document (in case one works with chapters).", x => this.Geometry = StripGeometry.Parse(x) }, { "p|port=", "The port of the server (if applicable, by default 8080).", x => this.Port = int.Parse(x) }, { "serverfolder", "The root of the folder of the web server.", x => this.ServerFolder = x } }; }
public void CreateMainMenu (Gtk.Menu menu) { menu.Append (CropToSelection.CreateAcceleratedMenuItem (Gdk.Key.X, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask)); menu.Append (AutoCrop.CreateAcceleratedMenuItem (Gdk.Key.X, Gdk.ModifierType.Mod1Mask | Gdk.ModifierType.ControlMask)); menu.Append (Resize.CreateAcceleratedMenuItem (Gdk.Key.R, Gdk.ModifierType.ControlMask)); menu.Append (CanvasSize.CreateAcceleratedMenuItem (Gdk.Key.R, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask)); menu.AppendSeparator (); menu.Append (FlipHorizontal.CreateMenuItem ()); menu.Append (FlipVertical.CreateMenuItem ()); menu.AppendSeparator (); menu.Append (RotateCW.CreateAcceleratedMenuItem (Gdk.Key.H, Gdk.ModifierType.ControlMask)); menu.Append (RotateCCW.CreateAcceleratedMenuItem (Gdk.Key.G, Gdk.ModifierType.ControlMask)); menu.Append (Rotate180.CreateAcceleratedMenuItem (Gdk.Key.J, Gdk.ModifierType.ControlMask)); menu.AppendSeparator (); menu.Append (Flatten.CreateAcceleratedMenuItem (Gdk.Key.F, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask)); }
public void TestParse() { CanvasSize ds; ds = CanvasSize.Parse("400x600"); Assert.AreEqual(400, ds.Width); Assert.AreEqual(600, ds.Height); Assert.AreEqual(CanvasSize.DefaultMargin, ds.Margin); ds = CanvasSize.Parse("400x600x32"); Assert.AreEqual(400, ds.Width); Assert.AreEqual(600, ds.Height); Assert.AreEqual(32, ds.Margin); ds = CanvasSize.Parse("32 x 400@600"); Assert.AreEqual(32, ds.Width); Assert.AreEqual(400, ds.Height); Assert.AreEqual(600, ds.Margin); }
public void TestRequiresQuadPrecision() { string connectionId = "dummy"; int maxIterations = 100; CanvasSize canvasSize = new CanvasSize(1000, 1000); //DPoint leftBot = new DPoint(-0.7764118407199196, 0.13437492059936854); //DPoint rightTop = new DPoint(-0.7764117329761986, 0.13437499747905846); SPoint leftBot = new SPoint("-0.7764118407199196", "0.13437492059936854"); SPoint rightTop = new SPoint("-0.7764118407199300", "0.13437499747905846"); SCoords coords = new SCoords(leftBot, rightTop); MapSection area = new MapSection(new Point(0, 0), canvasSize.GetWholeUnits(Engine.BLOCK_SIZE)); SMapWorkRequest mapWorkRequest = new SMapWorkRequest("FET2", coords, canvasSize, area, maxIterations, connectionId); bool requiresQuadPrecision = mapWorkRequest.RequiresQuadPrecision(); }
private FJobRequest CreateFJobRequest(SCoordsWorkRequest sCoordsWorkRequest, int jobId) { SCoords sCoords = sCoordsWorkRequest.SCoords; MqMessages.Coords coords = new MqMessages.Coords(sCoords.LeftBot.X, sCoords.RightTop.X, sCoords.LeftBot.Y, sCoords.RightTop.Y); CanvasSize cs = sCoordsWorkRequest.CanvasSize; SizeInt samplePoints = new SizeInt(cs.Width, cs.Height); MapSection ms = sCoordsWorkRequest.MapSection; RectangleInt area = new RectangleInt(new PointInt(ms.SectionAnchor.X, ms.SectionAnchor.Y), new SizeInt(ms.CanvasSize.Width, ms.CanvasSize.Height)); string name = "CoordsRequest"; FJobRequest fJobRequest = new FJobRequest(jobId, name, FJobRequestType.TransformCoords, coords, area, samplePoints, 0, sCoordsWorkRequest.TransformType); return(fJobRequest); }
static SMapWorkRequest CreateWorkRequest(int jobId) { CanvasSize canvasSize = new CanvasSize(300, 200); DPoint leftBot = new DPoint(-2, -1); DPoint rightTop = new DPoint(1, 1); SCoords coords = new SCoords(new SPoint(leftBot), new SPoint(rightTop)); MapSection area = new MapSection(new Point(0, 0), canvasSize.GetWholeUnits(Engine.BLOCK_SIZE)); int maxIterations = 100; string connectionId = "dummy"; SMapWorkRequest mapWorkRequest = new SMapWorkRequest("FEngRunner", coords, canvasSize, area, maxIterations, connectionId) { JobId = jobId }; return(mapWorkRequest); }
public void RegisterActions(Gtk.Application app, GLib.Menu menu) { app.AddAccelAction(CropToSelection, "<Primary><Shift>X"); menu.AppendItem(CropToSelection.CreateMenuItem()); app.AddAccelAction(AutoCrop, "<Ctrl><Alt>X"); menu.AppendItem(AutoCrop.CreateMenuItem()); app.AddAccelAction(Resize, "<Primary>R"); menu.AppendItem(Resize.CreateMenuItem()); app.AddAccelAction(CanvasSize, "<Primary><Shift>R"); menu.AppendItem(CanvasSize.CreateMenuItem()); var flip_section = new GLib.Menu(); menu.AppendSection(null, flip_section); app.AddAction(FlipHorizontal); flip_section.AppendItem(FlipHorizontal.CreateMenuItem()); app.AddAction(FlipVertical); flip_section.AppendItem(FlipVertical.CreateMenuItem()); var rotate_section = new GLib.Menu(); menu.AppendSection(null, rotate_section); app.AddAccelAction(RotateCW, "<Primary>H"); rotate_section.AppendItem(RotateCW.CreateMenuItem()); app.AddAccelAction(RotateCCW, "<Primary>G"); rotate_section.AppendItem(RotateCCW.CreateMenuItem()); app.AddAccelAction(Rotate180, "<Primary>J"); rotate_section.AppendItem(Rotate180.CreateMenuItem()); var flatten_section = new GLib.Menu(); menu.AppendSection(null, flatten_section); app.AddAccelAction(Flatten, "<Primary><Shift>F"); flatten_section.AppendItem(Flatten.CreateMenuItem()); }
public void GetHistogramTest() { int w = 108; // blocks int h = 72; CanvasSize imageSize = new CanvasSize(w * 100, h * 100); string fn = "17"; string filename = $"MandlebrodtMapInfo ({fn})"; string imagePath = Path.Combine(BasePath, $"MBB({fn})_{imageSize.Width}.png"); IDictionary <int, int> hist = new Dictionary <int, int>(); ValueRecords <RectangleInt, MapSectionWorkResult> countsRepo = new ValueRecords <RectangleInt, MapSectionWorkResult>(filename, useHiRezFolder: false); RectangleInt key = new RectangleInt(new PointInt(0, 0), new SizeInt(100, 100)); MapSectionWorkResult workResult = new MapSectionWorkResult(10000, hiRez: false, includeZValuesOnRead: false); for (int vBPtr = 0; vBPtr < h; vBPtr++) { key.Point.Y = vBPtr * 100; for (int hBPtr = 0; hBPtr < w; hBPtr++) { key.Point.X = hBPtr * 100; if (countsRepo.ReadParts(key, workResult)) { foreach (int cntAndEsc in workResult.Counts) { int cnt = cntAndEsc / 10000; if (hist.TryGetValue(cnt, out int occurances)) { hist[cnt] = occurances + 1; } else { hist[cnt] = 1; } } } } } Debug.WriteLine($"The histogram has {hist.Count} entries."); }
static public SizeF ToGdiSizeF(this CanvasSize canvasSizeF) { return(new SizeF(canvasSizeF.Width, canvasSizeF.Height)); }
static public Size ToGdiSize(this CanvasSize canvasSize) { return(new Size(canvasSize.Width, canvasSize.Height)); }
public void Build(string fn, bool hiRez) { // TODO: HiRez, blockWidth and blockHeight should come from the RepoFile. MapInfoWithColorMap miwcm = ReadFromJson(fn); int maxIterations = miwcm.MapInfo.MaxIterations; ColorMap colorMap = miwcm.ColorMap; string repofilename = miwcm.MapInfo.Name; //ValueRecords<KPoint, MapSectionWorkResult> countsRepo = new ValueRecords<KPoint, MapSectionWorkResult>(repofilename, useHiRezFolder: hiRez); //int blockLength = BlockWidth * BlockHeight; //MapSectionWorkResult workResult = new MapSectionWorkResult(blockLength, hiRez: hiRez, includeZValuesOnRead: false); //CanvasSize imageSizeInBlocks = GetImageSizeInBlocks(countsRepo); int blockLength = BlockWidth * BlockHeight; CountsRepoReader countsRepoReader = new CountsRepoReader(repofilename, hiRez, BlockWidth, BlockHeight); CanvasSize imageSizeInBlocks = GetImageSizeInBlocks(countsRepoReader); int w = imageSizeInBlocks.Width; int h = imageSizeInBlocks.Height; CanvasSize imageSize = new CanvasSize(w * BlockWidth, h * BlockHeight); string imagePath = GetImageFilename(fn, imageSize.Width, hiRez, BasePath); KPoint key = new KPoint(0, 0); using (PngImage pngImage = new PngImage(imagePath, imageSize.Width, imageSize.Height)) { for (int vBPtr = 0; vBPtr < h; vBPtr++) { key.Y = vBPtr; for (int lPtr = 0; lPtr < 100; lPtr++) { ImageLine iLine = pngImage.ImageLine; int linePtr = vBPtr * BlockHeight + lPtr; for (int hBPtr = 0; hBPtr < w; hBPtr++) { key.X = hBPtr; //if (countsRepo.ReadParts(key, workResult)) //{ // int[] allCounts = workResult.Counts; // int[] countsForThisLine = GetOneLineFromCountsBlock(allCounts, lPtr); // BuildPngImageLineSegment(hBPtr * BlockWidth, countsForThisLine, iLine, maxIterations, colorMap); //} //else //{ // BuildBlankPngImageLineSegment(hBPtr * BlockWidth, BlockWidth, iLine); //} int[] countsForThisLine = countsRepoReader.GetCounts(key, lPtr); if (countsForThisLine != null) { BuildPngImageLineSegment(hBPtr * BlockWidth, countsForThisLine, iLine, maxIterations, colorMap); } else { BuildBlankPngImageLineSegment(hBPtr * BlockWidth, BlockWidth, iLine); } } pngImage.WriteLine(iLine); } } } }
static SCoordsWorkRequest GetTransformWorkRequestZ(int jobId, SCoords curCoords, CanvasSize samplePoints) { MapSection mapSection = new MapSection(new Point(40, 40), new CanvasSize(20, 20)); SCoordsWorkRequest result = new SCoordsWorkRequest(TransformType.In, curCoords, samplePoints, mapSection, jobId); return(result); }