private void Start()
    {
        coordGen    = gameObject.GetComponent <CoordinateGenerator>();
        roadGen     = gameObject.GetComponent <RoadGenerator>();
        buildingGen = gameObject.GetComponent <BuildingGenerator>();

        GenerateRoads();
    }
Beispiel #2
0
        public void Render(Image image, Drawable drawable, bool preview)
        {
            int size = GetValue <int>("size");

            image.UndoGroupStart();

            var procedure = new Procedure("plug_in_pixelize");

            procedure.Run(image, drawable, size);

            var palette = new MinisteckPalette();

            image.ConvertIndexed(ConvertDitherType.No, ConvertPaletteType.Custom,
                                 0, false, false, "Ministeck");
            palette.Delete();

            image.ConvertRgb();
            image.UndoGroupEnd();

            // And finally calculate the Ministeck pieces

            using (var painter = new Painter(drawable, size, GetValue <RGB>("color")))
            {
                Shape.Painter = painter;

                int width  = drawable.Width / size;
                int height = drawable.Height / size;

                var A = new BoolMatrix(width, height);

                // Fill in shapes
                bool limit  = GetValue <bool>("limit");
                var  shapes = new ShapeSet();
                shapes.Add((limit) ? 2 : 1, new TwoByTwoShape());
                shapes.Add((limit) ? 8 : 1, new ThreeByOneShape());
                shapes.Add((limit) ? 3 : 1, new TwoByOneShape());
                shapes.Add((limit) ? 2 : 1, new CornerShape());
                shapes.Add((limit) ? 1 : 1, new OneByOneShape());

                Action <int> update = null;
                if (!preview)
                {
                    var progress = new Progress(_("Ministeck..."));
                    update = y => progress.Update((double)y / height);
                }

                var generator =
                    new CoordinateGenerator(new Rectangle(0, 0, width, height), update);
                generator.ForEach(c => { if (!A.Get(c))
                                         {
                                             shapes.Fits(A, c);
                                         }
                                  });
            }

            drawable.Flush();
            drawable.Update();
        }
Beispiel #3
0
    private void Start()
    {
        CoordinateGenerator coordGen = gameObject.GetComponent <CoordinateGenerator>();

        chunkSize = coordGen.roadDistance;

        foreach (Renderer i in buildingContainer.GetComponentsInChildren <Renderer>())
        {
            i.enabled = false;
        }

        foreach (Renderer i in roadContainer.GetComponentsInChildren <Renderer>())
        {
            i.enabled = false;
        }

        NewChunkCenter(new Vector2(0, 0));

        //buildingContainer = gameObject.GetComponent<BuildingGenerator>().suburbContainer.transform.parent.gameObject;
        //roadContainer = gameObject.GetComponent<RoadGenerator>().horizontalContainer.transform.parent.gameObject;
    }
Beispiel #4
0
        static void Main(string[] args)
        {
            TrajectorySet newSet = new TrajectorySet("gnss_point.csv", new NewTrajectorySetCreator(), CoordinateGenerator.CRSParseFromEPSG(4326));

            IShapefile roadShapefile = VectorFactory.OpenShapefile("road.shp", VectorOpenMode.Common);

            IMapMatch mapMatchFunction = new HMMMapMatch(roadShapefile, 0.000173);

            IMapMatch mapMatchFunction2 = new HMMMapMatch(roadShapefile, 0.000173, roadShapefile.GetBoundaryBox(), "Direction");

            TrajectorySet matchedSet = new TrajectorySet();

            foreach (Trajectory trajectory in newSet.TrajectoryList)
            {
                Trajectory mapMatchedTrajectory = mapMatchFunction.MatchRoute(trajectory, 0.000173 * 2, 10);

                matchedSet.AddTrajectory(mapMatchedTrajectory);
            }

            IShapefile matchedShapefile = matchedSet.ExportToShapefile(CoordinateGenerator.CRSParseFromEPSG(4326));

            matchedShapefile.ExportShapefile("matchedTrajectory2.shp");
        }
Beispiel #5
0
        public void Render(Image image, Drawable drawable, bool preview)
        {
            int size = GetValue<int>("size");

              image.UndoGroupStart();

              var procedure = new Procedure("plug_in_pixelize");
              procedure.Run(image, drawable, size);

              var palette = new MinisteckPalette();
              image.ConvertIndexed(ConvertDitherType.No, ConvertPaletteType.Custom,
               0, false, false, "Ministeck");
              palette.Delete();

              image.ConvertRgb();
              image.UndoGroupEnd();

              // And finally calculate the Ministeck pieces

              using (var painter = new Painter(drawable, size, GetValue<RGB>("color")))
            {
              Shape.Painter = painter;

              int width = drawable.Width / size;
              int height = drawable.Height / size;

              var A = new BoolMatrix(width, height);

              // Fill in shapes
              bool limit = GetValue<bool>("limit");
              var shapes = new ShapeSet();
              shapes.Add((limit) ? 2 : 1, new TwoByTwoShape());
              shapes.Add((limit) ? 8 : 1, new ThreeByOneShape());
              shapes.Add((limit) ? 3 : 1, new TwoByOneShape());
              shapes.Add((limit) ? 2 : 1, new CornerShape());
              shapes.Add((limit) ? 1 : 1, new OneByOneShape());

              Action<int> update = null;
              if (!preview)
            {
              var progress = new Progress(_("Ministeck..."));
              update = y => progress.Update((double) y / height);
            }

              var generator =
            new CoordinateGenerator(new Rectangle(0, 0, width, height), update);
              generator.ForEach(c => {if (!A.Get(c)) shapes.Fits(A, c);});
            }

              drawable.Flush();
              drawable.Update();
        }