// ------------------------------------------------------------------------------------------------------ // // --------------------------------- S T A R T & U P D A T E ------------------------------------------ // // ------------------------------------------------------------------------------------------------------ // void Start() { carbehaviour = GameObject.FindGameObjectWithTag("Player").GetComponent <CarBehaviour>(); baseline = GameObject.FindGameObjectWithTag("baseline").GetComponent <Baseline>(); fileManagement = GameObject.FindGameObjectWithTag("fileManager").GetComponent <FileManagement>(); difficultySettings = GameObject.FindGameObjectWithTag("Difficulty").GetComponent <DifficultySettings>(); block = GameObject.FindGameObjectWithTag("block").GetComponent <BlockManager>(); // Start spawning further down so we get an edge at the bottom on start planeEdgeZ = -1000f; times = 0; previousLanes = 0; SpawnNewPlane(0); seconds = 0; timer = -3f; startTimer = false; first = true; createBaselineNow = true; spawnCarX = 0; spawnCarY = 0; spawnCarZ = 0; // When the start the game, the game is easier spawing less cars with longer distances between them startDistance = 500; numberOfCars = 1; distance = 300; difficultyLvl = 1; fileManagement.createDataFile(); filePath = fileManagement.getFilePath(); PlayerPrefs.SetInt("startingNewBlock", 0); PlayerPrefs.SetInt("numberOfBlocks", PlayerPrefs.GetInt("numberOfBlocks") + 1); }
public void Serialize(object obj, BinaryDataWriter writer, IBaseline <TKey> baseline) { IBinaryObjectCollection <TKey> collections = (IBinaryObjectCollection <TKey>)obj; List <TKey> baseKeys = new List <TKey>(baseline.BaselineKeys); foreach (TKey key in collections.Keys) { BinaryDataWriter itemWriter = writer.TryWriteNode(_keySize); Baseline <byte> itemBaseline = baseline.GetOrCreateBaseline <Baseline <byte> >(key, _itemSerializer.Count, out bool isNew); _itemSerializer.Serialize(collections[key], itemWriter, itemBaseline); if (itemWriter.Length > 0 || isNew) { _writer.Write(writer, key); itemWriter.PushNode(); } baseKeys.Remove(key); } if (baseKeys.Count <= 0) { return; } _writer.Write(writer, _reservedKey); foreach (TKey key in baseKeys) { _writer.Write(writer, key); baseline.DestroyBaseline(key); } }
static void Main(string[] args) { Console.WriteLine("Starting..."); List <Uri> targets = Baseline.ToUriList(args); Baseline baseline = new Baseline(targets, 1500); Beatline beatline = new Beatline(); Console.WriteLine("Baseline contain(s) " + baseline.Count.ToString() + " node(s)"); ConsoleCrawlRecorder consoleListener = new ConsoleCrawlRecorder(); BeatCrawlRecorder recorder = new BeatCrawlRecorder(beatline); MultiplexCrawlRecorder listener = new MultiplexCrawlRecorder(new ICrawlRecorder[] { consoleListener, recorder }); Spider spider = new Spider(baseline, new Pruner(targets, listener, 10), listener); Console.WriteLine("Spider initialized."); do { spider.Crawl(); Console.WriteLine("--> Baseline contain(s) " + baseline.Count.ToString() + " node(s)"); Console.WriteLine("--> Beatline contain(s) " + beatline.Count.ToString() + " beat(s)"); if (beatline.Count > 0) { Console.WriteLine("--> Last beat contain(s) " + beatline[beatline.Count - 1].Count.ToString() + " node(s)"); } Console.WriteLine("--> press a key to exit"); System.Threading.Thread.Sleep(5000); } while (!Console.KeyAvailable); spider.Stop(); Console.WriteLine("End."); }
/// <summary> /// 建立输出文件路径 /// </summary> /// <param name="outPath"></param> /// <param name="file"></param> /// <returns></returns> protected string BuildOutputFilePath(string outPath, Baseline file) { var outFile = Path.Combine(outPath, "Sites", file.StartName + "-" + file.EndName + ".BaselineResult.xls"); // var outFile = Geo.Utils.FileUtil.GetOutputFilePath(outPath, file) + ".PositionResult.xsl"; return(outFile); }
public async Task SmokeTest() { const string code = @" x = 'str' class C: x: int def __init__(self): self.y = 1 def method(self): return func() @property def prop(self) -> int: return x def func(): return 2.0 c = C() "; var analysis = await GetAnalysisAsync(code); var model = ModuleModel.FromAnalysis(analysis, Services, AnalysisCachingLevel.Library); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); }
public async Task SmokeTest() { const string code = @" x = 'str' class C: x: int def __init__(self): self.y = 1 def method(self): return func() @property def prop(self) -> int: return x def func(): return 2.0 c = C() "; var model = await GetModelAsync(code); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); }
public static void DrawString(this Graphics2D gx, string text, double x, double y, double pointSize = 12, Justification justification = Justification.Left, Baseline baseline = Baseline.Text, ColorRGBA color = new ColorRGBA(), bool drawFromHintedCache = false, ColorRGBA backgroundColor = new ColorRGBA()) { ////use svg font var svgFont = SvgFontStore.LoadFont(SvgFontStore.DEFAULT_SVG_FONTNAME, (int)pointSize); var stringPrinter = new MyTypeFacePrinter(); stringPrinter.CurrentFont = svgFont; stringPrinter.DrawFromHintedCache = false; stringPrinter.LoadText(text); var vxs = stringPrinter.MakeVxs(); vxs = Affine.NewTranslation(x, y).TransformToVxs(vxs); gx.Render(vxs, ColorRGBA.Black); }
public override List <FilledBaseline> Generate(Scenario scenario, Baseline baseline, ProductionParameters prodParams) { this.prodParams = prodParams; var projectsWithSmallBatchSizes = scenario.Projects.Where(p => p.Batches.Any(b => b.UsedWorkHours < 2)).ToArray(); var sizes = scenario.Projects.SelectMany(p => p.Batches.Select(b => b.UsedWorkHours / 24)).OrderBy(d => d).ToArray(); requiredProjects = scenario.Projects.Where(p => p is FixedProject || baseline.Projects.Contains(p)).OrderBy(p => p.DeliveryDate).ToArray(); potentialFillers = scenario.Projects.Except(requiredProjects).OrderBy(p => p.DeliveryDate).ToList(); earliestDate = scenario.Projects.Min(p => p.DeliveryDate); numberOfMonths = prodParams.PlanningHorizon + 1; FilledBaselines = new List <FilledBaseline>(); // calc the monly loads of all fixed project batches and the required opportunities var monthlyOverload = Enumerable.Range(0, numberOfMonths).Select(i => 0f).ToList(); AddToMonthlyOverload(monthlyOverload, requiredProjects); // group the projects by week // create schedules by combining: Fill(requiredProjects.ToArray(), monthlyOverload, 0, 1); // Assign the baseline to the FilledBaselines foreach (var fb in FilledBaselines) { fb.Baseline = baseline; } return(FilledBaselines); }
public async Task NestedClasses() { const string code = @" x = 'str' class A: def methodA(self): return True class B: x: int class C: def __init__(self): self.y = 1 def methodC(self): return False def methodB1(self): return self.C() def methodB2(self): return self.C().y c = B().methodB1() "; var analysis = await GetAnalysisAsync(code); var model = ModuleModel.FromAnalysis(analysis, Services, AnalysisCachingLevel.Library); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); }
public double DobivanjeDuljineLinka(string ime, double station) { double ukupnaDuljina = 0; Baseline bl = corridors.SingleOrDefault(x => x.Name == _Naziv).Baselines[0] as Baseline; AppliedAssembly applied = bl.GetAppliedAssemblyAtStation(station); CalculatedLinkCollection clLinks = applied.GetLinksByCode(ime); if (clLinks == null) { return(0); } foreach (CalculatedLink link in clLinks) { CalculatedPointCollection clPoints = link.CalculatedPoints; Point3d point1 = new Point3d(clPoints[0].StationOffsetElevationToBaseline.X, clPoints[0].StationOffsetElevationToBaseline.Y, clPoints[0].StationOffsetElevationToBaseline.Z); Point3d point2 = new Point3d(clPoints[1].StationOffsetElevationToBaseline.X, clPoints[1].StationOffsetElevationToBaseline.Y, clPoints[1].StationOffsetElevationToBaseline.Z); double udaljenost = point1.DistanceTo(point2); ukupnaDuljina = ukupnaDuljina + udaljenost; } return(ukupnaDuljina); }
public async Task NestedClasses() { const string code = @" x = 'str' class A: def methodA(self): return True class B: x: int class C: def __init__(self): self.y = 1 def methodC(self): return False def methodB1(self): return self.C() def methodB2(self): return self.C().y c = B().methodB1() "; var model = await GetModelAsync(code); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); }
public void DrawString(string text, double x, double y, double pointSize = 12, Justification justification = Justification.Left, Baseline baseline = Baseline.Text, Color color = default(Color), bool drawFromHintedCach = false, Color backgroundColor = default(Color), bool bold = false) { TypeFacePrinter stringPrinter = new TypeFacePrinter(text, pointSize, new Vector2(x, y), justification, baseline, bold); if (color.Alpha0To255 == 0) { color = Color.Black; } if (backgroundColor.Alpha0To255 != 0) { FillRectangle(stringPrinter.LocalBounds, backgroundColor); } stringPrinter.DrawFromHintedCache = drawFromHintedCach; stringPrinter.Render(this, color); }
public ActionResult Create(BaselineCreateModel model) { if (model.Descricao == null || model.Descricao.Trim().Length == 0) { Error("Digite a descrição do baseline!"); } else { using (var ctx = new Entities()) { Baseline bl = new Baseline(); bl.CellID = RouteData.Values["cell"].GetCellID(); bl.UserID = Authentication.GetLoggedUser().UserID; bl.SetDate = DateTime.Parse(model.SetDate); bl.Message = model.Descricao; ctx.Baselines.Add(bl); if (ctx.SaveChanges() != 0) { Success("Baseline registrado com sucesso!"); return(RedirectToAction("Index")); } else { Error("Erro ao tentar registrar o baseline!"); } } } return(View(model)); }
public async Task MemberLocations() { const string code = @" x = 'str' def sum(a, b): return a + b class B: x: int class C: def __init__(self): pass def methodC(self): pass @property def propertyB(self): return 1 def methodB2(self): return 2 "; var analysis = await GetAnalysisAsync(code); var model = ModuleModel.FromAnalysis(analysis, Services, AnalysisCachingLevel.Library); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); using (var dbModule = new PythonDbModule(model, analysis.Document.FilePath, Services)) { dbModule.Construct(model); var sum = dbModule.GetMember("sum") as IPythonFunctionType; sum.Should().NotBeNull(); sum.Definition.Span.Should().Be(4, 5, 4, 8); var b = dbModule.GetMember("B") as IPythonClassType; b.Should().NotBeNull(); b.Definition.Span.Should().Be(7, 7, 7, 8); var c = b.GetMember("C") as IPythonClassType; c.Should().NotBeNull(); c.Definition.Span.Should().Be(10, 11, 10, 12); var methodC = c.GetMember("methodC") as IPythonFunctionType; methodC.Should().NotBeNull(); methodC.Definition.Span.Should().Be(13, 13, 13, 20); var propertyB = b.GetMember("propertyB") as IPythonPropertyType; propertyB.Should().NotBeNull(); propertyB.Definition.Span.Should().Be(17, 9, 17, 18); var methodB2 = b.GetMember("methodB2") as IPythonFunctionType; methodB2.Should().NotBeNull(); methodB2.Definition.Span.Should().Be(20, 9, 20, 17); } }
public static PSSqlVulnerabilityAssessmentBaseline ConvertToPSType(this Baseline value) { return(new PSSqlVulnerabilityAssessmentBaseline() { ExpectedResults = value.ExpectedResults?.Select(result => result.ToArray()).ToArray() ?? new string[0][], UpdatedTime = value.UpdatedTime }); }
public TypeFacePrinter(String text, StyledTypeFace typeFaceStyle, Vector2 origin = new Vector2(), Justification justification = Justification.Left, Baseline baseline = Baseline.Text) { this.TypeFaceStyle = typeFaceStyle; this.text = text; this.Justification = justification; this.Origin = origin; this.Baseline = baseline; }
public override int GetHashCode() { unchecked { var hashCode = Name?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ Baseline.GetHashCode(); return(hashCode); } }
public bool Equals(UIFont other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(string.Equals(Name, other.Name) && Baseline.Equals(other.Baseline)); }
public void DrawString(string text, Vector2 position, double pointSize = 12, Justification justification = Justification.Left, Baseline baseline = Baseline.Text, Color color = default(Color), bool drawFromHintedCach = false, Color backgroundColor = default(Color), bool bold = false) { DrawString(text, position.X, position.Y, pointSize, justification, baseline, color, drawFromHintedCach, backgroundColor, bold); }
public static double GetYOffsetFromBaseline(Baseline arg) { switch (arg) { case Baseline.Top: return(0); case Baseline.Middle: return(0.5); case Baseline.Bottom: return(1); default: return(0); } }
private void setTypeBaseline(Baseline baseline) { if (rTxtCtrl.TextLength > styleSet.Last().Key) { StyleInfo newStyle = new StyleInfo(styleSet.Last().Value); newStyle.typeBaseline = baseline; styleSet.Add(rTxtCtrl.TextLength, newStyle); } else { styleSet.Last().Value.typeBaseline = baseline; } }
public void PopunjavanjeListeStacionaza() { using (Transaction ts = db.TransactionManager.StartTransaction()) { Baseline bl = corridors.SingleOrDefault(x => x.Name == _Naziv).Baselines[0] as Baseline; foreach (double stacionaza in bl.SortedStations()) { //stacionaze.Add(Math.Round(stacionaza, civDoc.Settings.DrawingSettings.AmbientSettings.Station.Precision.Value)); //zbog nekog rezloga ne radi iako bi po svemu trebalo !!! stacionaze.Add(stacionaza); } } }
/// <summary> /// Copy constructor /// </summary> /// <param name="style"></param> public StyleInfo(StyleInfo style) { typeFace = style.typeFace; typeSize = style.typeSize; typeCompress = style.typeCompress; typeBaseline = style.typeBaseline; isUnderline = style.isUnderline; isBold = style.isBold; isItalic = style.isItalic; isOutline = style.isOutline; shade = style.shade; justification = style.justification; lineSpacing = style.lineSpacing; }
public float lineSpacing; // 0.75, 1.0, 1.5, 2.0, 2.5 or 3.0 /// <summary> /// Default settings constructor /// </summary> public StyleInfo() { typeFace = Face.Courier; typeSize = 12; typeCompress = Compress.Normal; typeBaseline = Baseline.Regular; isUnderline = false; isBold = false; isItalic = false; isOutline = false; shade = Shading.None; justification = ParagraphJust.Left; lineSpacing = 1.0f; }
public static XElement WriteBaselineXML(Artifact item, DateTime AbsoluteStart) { Baseline blItem = item.ArtifactData as Baseline; var value = new XElement("event", new XAttribute("start", ((int)((item.StartTime - AbsoluteStart).TotalSeconds * 4)).ToString(CultureInfo.InvariantCulture)), new XAttribute("peak", "-1"), new XAttribute("end", ((int)((item.EndTime - AbsoluteStart).TotalSeconds * 4)).ToString(CultureInfo.InvariantCulture)), new XAttribute("contraction", "-1"), new XAttribute("type", "9"), new XAttribute("y1", blItem.Y1.ToString("0.000000", CultureInfo.InvariantCulture)), new XAttribute("y2", blItem.Y2.ToString("0.000000", CultureInfo.InvariantCulture))); return(value); }
public async Task Builtins() { var analysis = await GetAnalysisAsync(string.Empty); var builtins = analysis.Document.Interpreter.ModuleResolution.BuiltinsModule; var model = ModuleModel.FromAnalysis(builtins.Analysis, Services, AnalysisCachingLevel.Library); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); var dbModule = new PythonDbModule(model, null, Services); dbModule.Should().HaveSameMembersAs(builtins); }
public void Serialize(object obj, BinaryDataWriter writer, IBaseline <TKey> baseline) { BinaryDataWriter childWriter = writer.TryWriteNode(sizeof(byte)); Baseline <TChildKey> itemBaseline = baseline.GetOrCreateBaseline <Baseline <TChildKey> >(_index, _valuesCount, out bool isNew); _serializer.Serialize(_getter(obj), childWriter, itemBaseline); if (childWriter.Length <= 0 && !isNew) { return; } WriteKey(_index, writer); childWriter.PushNode(); }
public static byte[] Serialize(object obj, Baseline <byte> baseline) { CompositeBinarySerializer serializer = GetSerializer(obj.GetType()); if (!baseline.HasValues) { baseline.CreateValues(serializer.Count); } using (BinaryDataWriter writer = new BinaryDataWriter()) { serializer.Serialize(obj, writer, baseline); return(writer.GetData()); } }
/// <summary> /// Encapsulates the entire parking lot state /// change, triggerd by Camera changes /// </summary> public void Update() { if (Baseline != null && Baseline.SameSize(Camera.CurrentImage)) { lock (this) { // Reset percentDifferences to zero Annotations.ForEach(a => a.PercentDifference = 0); // Maps annotations to their area in pixels Dictionary <Annotation, int> annotationPixelAreas = Annotations.ToDictionary(a => a, a => 0); // Get the raw pixel difference (color sensitive) Bitmap baseline = Baseline; Bitmap current = Camera.CurrentImage; Bitmap difference = baseline.Difference( current.Add( // Adjust the current image by the average light difference // between the baseline and current image AverageDifference( baseline, current, Annotations.Where(a => a.Type == Annotation.AnnotationType.Constant ) ) ) ); // Sum up difference percentage contained by each annotation for (int x = 0; x < difference.Width; x++) { for (int y = 0; y < difference.Height; y++) { Vector2 pixelPoint = new Vector2((double)x / difference.Width, (double)y / difference.Height); foreach (Annotation annotation in Annotations.Where(a => a.Contains(pixelPoint))) { annotationPixelAreas[annotation]++; annotation.PercentDifference += difference.GetPixel(x, y).Value(); } } } // Normalize the difference percentages by dividing out the total pixel area foreach (var pixelArea in annotationPixelAreas.Where(p => p.Value > 0)) { pixelArea.Key.PercentDifference /= pixelArea.Value; } } } }
public Point3d PocetnaTockaNaStacionaziD(Corridor plovniPut) { Corridor corr = plovniPut; Baseline bl = corr.Baselines[0]; AppliedAssembly appliedassy = bl.GetAppliedAssemblyAtStation(stacionaza); CalculatedPointCollection pts = appliedassy.Points; CalculatedPointCollection ptsbycode = appliedassy.GetPointsByCode("UglavljeDesno"); Point3d pt3 = ptsbycode[0].StationOffsetElevationToBaseline; Point3d ptWorld = bl.StationOffsetElevationToXYZ(pt3); return(ptWorld); }
public void DrawString(string text, Font font, TypeFace typeFace, Brush brush, float x, float y, Justification justification = Justification.Left, Baseline baseline = Baseline.BoundsTop) { SolidBrush colorBrush = brush as SolidBrush; //var s1 = new TypeFacePrinter (text, font.SizeInPoints, new MatterHackers.VectorMath.Vector2 (0, 0), Justification.Left, Baseline.BoundsTop); var s1 = new TypeFacePrinter(text, new StyledTypeFace(typeFace, font.SizeInPoints, font.Underline), new MatterHackers.VectorMath.Vector2(0, 0), justification, baseline); var s2 = new VertexSourceApplyTransform(s1, Affine.NewScaling(1, -1)); if (x != 0.0f || y != 0.0f) { s2 = new VertexSourceApplyTransform(s2, Affine.NewTranslation(x, y)); } _InternalRender(s2, new RGBA_Bytes((uint)colorBrush.Color.ToArgb())); }
///<summary>Sets the value of the <c><Baselines></c> element.</summary> /// <param name="Baseline">The pre-assessment data to evaluate the student on the learning objective.</param> ///<remarks> /// <para>This form of <c>setBaselines</c> is provided as a convenience method /// that is functionally equivalent to the <c>Baselines</c></para> /// <para>Version: 2.6</para> /// <para>Since: 2.6</para> /// </remarks> public void SetBaselines( Baseline Baseline ) { RemoveChild( InstrDTD.RESPONSETOINTERVENTION_BASELINES); AddChild( InstrDTD.RESPONSETOINTERVENTION_BASELINES, new Baselines( Baseline ) ); }
public void DrawString(string Text, double x, double y, double pointSize = 12, Justification justification = Justification.Left, Baseline baseline = Baseline.Text, RGBA_Bytes color = new RGBA_Bytes(), bool drawFromHintedCach = false, RGBA_Bytes backgroundColor = new RGBA_Bytes()) { TypeFacePrinter stringPrinter = new TypeFacePrinter(Text, pointSize, new Vector2(x, y), justification, baseline); if (color.Alpha0To255 == 0) { color = RGBA_Bytes.Black; } if (backgroundColor.Alpha0To255 != 0) { FillRectangle(stringPrinter.LocalBounds, backgroundColor); } stringPrinter.DrawFromHintedCache = drawFromHintedCach; stringPrinter.Render(this, color); }
///<summary>Sets the value of the <c><Baselines></c> element.</summary> /// <param name="Baseline">The pre-assessment data to evaluate the student on the learning objective.</param> ///<remarks> /// <para>This form of <c>setBaselines</c> is provided as a convenience method /// that is functionally equivalent to the <c>Baselines</c></para> /// <para>Version: 2.6</para> /// <para>Since: 2.6</para> /// </remarks> public void SetBaselines( Baseline Baseline ) { RemoveChild( InstrDTD.RTIRESULTS_BASELINES); AddChild( InstrDTD.RTIRESULTS_BASELINES, new Baselines( Baseline ) ); }
/// <summary> /// Create a new Baseline object. /// </summary> /// <param name="ID">Initial value of Id.</param> /// <param name="testId">Initial value of TestId.</param> /// <param name="changed">Initial value of Changed.</param> public static Baseline CreateBaseline(int ID, int testId, global::System.DateTimeOffset changed) { Baseline baseline = new Baseline(); baseline.Id = ID; baseline.TestId = testId; baseline.Changed = changed; return baseline; }
public TypeFacePrinter(String text = "", double pointSize = 12, Vector2 origin = new Vector2(), Justification justification = Justification.Left, Baseline baseline = Baseline.Text) : this(text, new StyledTypeFace(LiberationSansFont.Instance, pointSize), origin, justification, baseline) { }