Inheritance: MonoBehaviour
Beispiel #1
0
    void OnEnable()
    {
        generator    = new SerializedObject(target);
        m_mapDisplay = (MapDisplay)target;

        m_row    = generator.FindProperty("m_row");
        m_column = generator.FindProperty("m_column");
    }
Beispiel #2
0
 void Awake()
 {
     falloffMap = FalloffGenerator.GenerateFalloffMap(mapWidth, mapHeight);
     display    = GetComponent <MapDisplay> ();
     instance   = this;
     mapData    = GenerateMapData(Vector2.zero);
     // DrawMapInEditor ();
 }
Beispiel #3
0
    public void GenerateMap()
    {
        float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, seed, noiseScale, octaves, persistance, lacuarity, offset);

        MapDisplay display = FindObjectOfType <MapDisplay>();

        display.DrawNoiseMap(noiseMap);
    }
    public void GenerateMap()
    {
        float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, noiseScale);

        MapDisplay display = FindObjectOfType <MapDisplay>();

        display.DrawNoiseMap(noiseMap);
    }
Beispiel #5
0
        public Chunk ToChunk(MapDisplay display)
        {
            var chunk = new Chunk();

            display.initialize(DBuffers);
            chunk.Init(ChunkPos, display, metaData);
            return(chunk);
        }
Beispiel #6
0
        public void GenerateMap()
        {
            float[,] noiseMap = Ecosystem.Grid.Noise.GenerateNoiseMap(MapWidth, MapHeight, Seed, MapScale, Octaves, Persistence, Lacunarity);

            MapDisplay display = FindObjectOfType <MapDisplay>();

            display.DrawTexture(TextureGenerator.TextureFromHeightMap(noiseMap));
        }
Beispiel #7
0
        public void GenerateMap()
        {
            float[,] _NoiseMap = Noise.GenerateNoiseMap(MapWidth, MapHeight, Seed, NoiseScale, Octaves, Persistance, Lacunarity, Offset);

            MapDisplay _MapDisplay = GetComponent <MapDisplay>();

            _MapDisplay.DrawNoiseMap(_NoiseMap);
        }
Beispiel #8
0
    public void GenerateMap()
    {
        //float[,] noiseMap = Noise.GenerateNoiseMap(MapWidth, MapHeight, noiseScale);

        MapDisplay display = GetComponent <MapDisplay>();

        //display.DrawNoiseMap(ref noiseMap);
    }
Beispiel #9
0
    public void DrawMapInEditor()
    {
        MapData mapData = GenerateMapData(Vector2.zero);

        MapDisplay display = FindObjectOfType <MapDisplay>();

        display.DrawMesh(MeshGenerator.GenerataTerrainMesh(mapData.heightMap, meshHeightMultiplier, meshHeightCurve, EditorPreviewLOD), TextureGenerator.TextureFromHeightMap(mapData.heightMap, mapData.colA, mapData.colB));
    }
Beispiel #10
0
 void Start()
 {
     regions                = FindObjectOfType <MapGenerator>().regions;
     mapGenerator           = FindObjectOfType <MapGenerator>();
     display                = FindObjectOfType <MapDisplay>();
     chunkSize              = MapGenerator.sizeMapChunk - 1;
     chunksVisibleInViewDst = Mathf.RoundToInt(maxViewDst / chunkSize);
 }
Beispiel #11
0
    private void DrawMesh()
    {
        MapData    mapData    = GenerateMapData(Vector2.zero);
        MapDisplay mapDisplay = FindObjectOfType <MapDisplay>();

        mapDisplay.DrawMesh(MeshGenerator.GenerateTerrainMesh(mapData.heightMap, meshHeightMultiplier, meshHeightCurve, editorPreviewLOD), TextureGenerator.TextureFromColorMap(mapData.colorMap, mapSize, mapSize));
        mapDisplay.DrawTexture(TextureGenerator.TextureFromColorMap(mapData.colorMap, mapSize, mapSize));
    }
Beispiel #12
0
    public void DrawMap()
    {
        MapData    mapData    = GenerateMapData(Vector2.zero);
        MapDisplay mapDisplay = FindObjectOfType <MapDisplay>();

        mapDisplay.DrawMesh(MeshGenerator.GenerateTerrain(mapData.heightMap, terrainData.meshHeightMultiplier, terrainData.meshHeightCurve, LevelOfDetailPreview));
        textureData.UpdateMeshHeights(terrainMaterial, terrainData.minHeight, terrainData.maxHeight);
    }
Beispiel #13
0
    public void GenerateMap()
    {
        MapDisplay display   = FindObjectOfType <MapDisplay>();
        Stopwatch  stopWatch = new Stopwatch();

        stopWatch.Start();

        if (drawMode == DrawMode.NoiseMap || drawMode == DrawMode.ColourMap)
        {
            float[,] noiseMapI = Mesh.GenerateNoiseMap(mapSize, mapSize, seed, scale, octaves, persistance, lacunarity, offset);

            if (drawMode == DrawMode.ColourMap)
            {
                float[,] falloffMapI = FalloffGenerator.GenerateFalloffMap(mapSize, falloff.x, falloff.y, falloffMode.ToString());
                Color[] colourMap = new Color[mapSize * mapSize];
                for (int y = 0; y < mapSize; y++)
                {
                    for (int x = 0; x < mapSize; x++)
                    {
                        if (useFalloff)
                        {
                            noiseMapI[x, y] = Mathf.Clamp(noiseMapI[x, y] - falloffMapI[x, y], 0, border);
                        }
                        float currentHeight = noiseMapI[x, y];
                        for (int i = 0; i < regions.Length; i++)
                        {
                            if (currentHeight <= regions[i].height)
                            {
                                colourMap[y * mapSize + x] = regions[i].colour;
                                break;
                            }
                        }
                    }
                }
                display.DrawTexture(TextureGenerator.TextureFromColourMap(colourMap, mapSize));
            }
            else
            {
                display.DrawTexture(TextureGenerator.TextureFromHeightMap(noiseMapI));
            }
            Debug.Log("Max height jump between neighbours: " + MaxNeighbourJump(noiseMapI) + "\n");
        }
        else if (drawMode == DrawMode.FalloffMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromHeightMap(FalloffGenerator.GenerateFalloffMap(mapSize, falloff.x, falloff.y, falloffMode.ToString())));
        }
        else if (drawMode == DrawMode.PolygonMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromHeightMap(MeshGenerator.GeneratePolygons(mapSize, polygonSize, polygonSeed)));
        }

        stopWatch.Stop();
        TimeSpan ts          = stopWatch.Elapsed;
        string   elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                             ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);

        Debug.Log("PolygonsRunTime " + elapsedTime);
    }
    public void GenerateMap()
    {
        float[,] noiseMap = Noise.GenerateNoiseMap(seed, mapWidth, mapHeight, noiseScale, octaves, persistance, lacunarity, offset);

        MapDisplay display = FindObjectOfType <MapDisplay>();

        display.threshold = threshold;

        Color[] colourMap = new Color[mapWidth * mapHeight];
        for (int y = 0; y < mapHeight; y++)
        {
            for (int x = 0; x < mapWidth; x++)
            {
                float currentHeight = noiseMap[x, y];
                for (int i = 0; i < regions.Length; i++)
                {
                    if (currentHeight <= regions[i].height)
                    {
                        colourMap[y * mapWidth + x] = regions[i].colour;
                        break;
                    }
                }
            }
        }

        _upperWall.transform.position   = new Vector3(0, 0, mapHeight / 2 - 1);
        _upperWall.transform.localScale = new Vector3(mapWidth + 1, multiplier * 2, 2.5f);
        _downWall.transform.position    = new Vector3(0, 0, -mapHeight / 2 + 1);
        _downWall.transform.localScale  = new Vector3(mapWidth + 1, multiplier * 2, 2.5f);
        _leftWall.transform.position    = new Vector3(-mapWidth / 2 + 1, 0, 0);
        _leftWall.transform.localScale  = new Vector3(2.5f, multiplier * 2, mapHeight + 1);
        _rightWall.transform.position   = new Vector3(mapWidth / 2 - 1, 0, 0);
        _rightWall.transform.localScale = new Vector3(2.5f, multiplier * 2, mapHeight + 1);

        if (drawMode == DrawMode.NoiseMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromHeightMap(noiseMap));
        }
        else if (drawMode == DrawMode.ColourMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromColourMap(colourMap, mapWidth, mapHeight));
        }
        else if (drawMode == DrawMode.terrainMesh)
        {
            display.DrawMesh(MeshGenerator.GenerateTerrainMesh(noiseMap, multiplier), TextureGenerator.TextureFromColourMap(colourMap, mapWidth, mapHeight));
        }
        else if (drawMode == DrawMode.DungeonMap)
        {
            display.DrawNoiseDungeon(noiseMap);
        }
        else if (drawMode == DrawMode.dungeonMesh)
        {
            display.DrawMesh(MeshGenerator.GenerateTerrainMesh(noiseMap, multiplier, threshold), TextureGenerator.TextureFromColourMap(colourMap, mapWidth, mapHeight));
        }
        else if (drawMode == DrawMode.infiniteDungeonMesh)
        {
        }
    }
Beispiel #15
0
    public void GenerateMap()
    {
        DestroyImmediate(GameObject.Find("Map"));
        float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, seed, noiseScale, octaves, persistence, lacunarity, offset);

        MapDisplay display = FindObjectOfType <MapDisplay> ();

        display.DrawTerrainMap(noiseMap);
    }
Beispiel #16
0
    protected override void UpdateDisplay()
    {
        if (!Target.Active)
        {
            MapDisplay.SafeDestroy(gameObject);
        }

        transform.position = WorldGenUtility.WorldToMeshPoint(Target.tile.position);
    }
Beispiel #17
0
            public static void Prefix(MapDisplay __instance)
            {
                var minimap = __instance.LocalCharacter?.GetComponentInChildren <MinimapScript>();

                if (minimap)
                {
                    minimap.OnHideBigMap();
                }
            }
    public override void OnInspectorGUI()
    {
        MapDisplay mapDisplay = (MapDisplay)target;

        if (DrawDefaultInspector())
        {
            mapDisplay.ForceRedrawAll();
        }
    }
Beispiel #19
0
    public void GenerateMap()
    {
        //generate noise map using perlin noise
        float[,] generatedNoiseMap = Noise.GenerateNoise(width, height, scale, octaves, persistance, lacunarity);

        //display the map
        theMapDisplay = GetComponent <MapDisplay>();
        theMapDisplay.DrawNoiseMap(generatedNoiseMap);
    }
    public void GenerateMap()
    {
        //Getting the noise map we generated in Noise.
        float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, noiseScale, octaves, persistance, lacunarity);

        MapDisplay display = FindObjectOfType <MapDisplay>();

        display.DrawNoiseMap(noiseMap);
    }
Beispiel #21
0
    /*
     * public void DrawMapInEditor ()
     * {
     *  MapData mapData = GenerateMapData();
     *
     *  MapDisplay display = FindObjectOfType<MapDisplay>();
     *  if (drawMode == DrawMode.NoiseMap)
     *  {
     *      display.DrawTexture(TextureGenerator.TextureFromHeightMap(mapData.heightMap));
     *  }
     *  else if (drawMode == DrawMode.ColourMap)
     *  {
     *      display.DrawTexture(TextureGenerator.TextureFromColourMap(mapData.colourMap, mapChunkSize, mapChunkSize));
     *  }
     *  else if (drawMode == DrawMode.Mesh)
     *  {
     *      display.DrawMesh(MeshGenerator.GenerateTerrainMesh(mapData.heightMap, meshHeightMultiplier, meshHeightCurve, levelOfDetail), TextureGenerator.TextureFromColourMap(mapData.colourMap, mapChunkSize, mapChunkSize));
     *  }
     * }
     */

    public void Generate()
    {
        float[,] noiseMap;
        MapDisplay display = FindObjectOfType <MapDisplay>();

        if (textureHeightMap)
        {
            float xRatio = textureHeightMap.width / mapWidth;
            float yRatio = textureHeightMap.height / mapHeight;
            noiseMap = new float[mapWidth, mapHeight];

            for (int x = 0; x < mapWidth; x++)
            {
                for (int y = 0; y < mapWidth; y++)
                {
                    noiseMap[x, y] = textureHeightMap.GetPixel(x * (int)xRatio, y * (int)yRatio).grayscale;
                }
            }
        }

        else
        {
            noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, seed, noiseScale, octaves, persistance, lacunarity, offset);
        }

        Color[] colourMap = new Color[mapWidth * mapHeight];

        for (int y = 0; y < mapHeight; y++)
        {
            for (int x = 0; x < mapWidth; x++)
            {
                float currentHeight = noiseMap[x, y];
                for (int i = 0; i < regions.Length; i++)
                {
                    if (currentHeight <= regions[i].height)
                    {
                        colourMap[y * mapWidth + x] = regions[i].colour;
                        break;
                    }
                }
            }
            switch (drawMode)
            {
            case DrawMode.NoiseMap:
                display.DrawTexture(TextureGenerator.TextureFromHeightMap(noiseMap));
                break;

            case DrawMode.ColourMap:
                display.DrawTexture(TextureGenerator.TextureFromColourMap(colourMap, mapWidth, mapHeight));
                break;

            case DrawMode.Mesh:
                display.DrawMesh(MeshGenerator.GenerateTerrainMesh(noiseMap, meshHeightMultiplier, meshHeightCurve, levelOfDetail), TextureGenerator.TextureFromColourMap(colourMap, mapWidth, mapHeight));
                break;
            }
        }
    }
Beispiel #22
0
    // Generate a bunch of points and the make the mesh and display it
    public void generateTrack()
    {
        points = new RacePoint[pointCount];
        generatePoints(seed);
        MapDisplay display  = FindObjectOfType <MapDisplay> ();
        MeshData   raceMesh = GenerateMap();

        display.DrawMesh(raceMesh);
    }
Beispiel #23
0
    public void DrawMapInEditor()
    {
        MapData mapData = GenerateMapData(Vector2.zero);

        MapDisplay display = FindObjectOfType <MapDisplay>();

        if (drawMode == DrawMode.NoiseMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromHeightMap(mapData.heightMap));
        }
        else if (drawMode == DrawMode.ColourMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromColourMap(mapData.colourMap, mapChunkSize, mapChunkSize));
        }
        else if (drawMode == DrawMode.Mesh)
        {
            display.DrawMesh(MeshGenerator.GenerateTerrainMesh(mapData.heightMap, meshHeightMultiplier, meshHeightCurve, editorPreviewLOD), TextureGenerator.TextureFromColourMap(mapData.colourMap, mapChunkSize, mapChunkSize));
            if (generateGameObjects)
            {
                GenerateGameObjects genGOScript = display.meshRenderer.transform.gameObject.GetComponent <GenerateGameObjects>();
                if (genGOScript == null)
                {
                    genGOScript = display.meshRenderer.transform.gameObject.AddComponent <GenerateGameObjects>();
                }
                genGOScript.seed = seed;
                genGOScript.StartGenerateObjects();
                genGOScript.offset        = offset;
                genGOScript.levelOfDetail = editorPreviewLOD;
                genGOScript.mapData       = mapData;
                genGOScript.genClouds     = generateClouds;
            }
        }
        else if (drawMode == DrawMode.Falloff)
        {
            display.DrawTexture(TextureGenerator.TextureFromHeightMap(FalloffGenerator.GenerateFalloffMap(mapChunkSize)));
        }

        if (generateWater)
        {
            bool genNewWater = true;
            foreach (Transform child in gameObject.transform)
            {
                if (child.tag == "Water")
                {
                    genNewWater = false;
                }
            }
            if (genNewWater)
            {
                EndlessTerrain endTer   = GetComponent <EndlessTerrain>();
                GameObject     waterIns = GameObject.Instantiate(endTer.waterPlane, new Vector3(0, -0.22f * EndlessTerrain.scale, 0), Quaternion.identity);
                waterIns.transform.parent = gameObject.transform;
                waterIns.AddComponent <DisableOnStartup>();
            }
        }
    }
    public void SaveMesh()
    {
        print("Creating Mesh");
        MapData    mapData = GenerateMapData(Vector2.zero);
        MapDisplay display = FindObjectOfType <MapDisplay>();
        Mesh       m       = MeshGenerator.GenerateTerrainMesh(mapData.heightMap, terrainData.mapHeightMultiplier, terrainData.meshHeightCurve, levelOfDetail, chunkSizeIndex).CreateMesh();

        print("Saving mesh");
        display.MeshDump(m);
    }
    public void UpdateSphereMap()
    {
        MapDisplay display = FindObjectOfType <MapDisplay>();

        noiseMap = updatedMap;
        Debug.Log(latestTimeProcessRequested + "updating map");
        mapTexture = GetMapTexture(renderType, noiseMap);
        display.DrawMesh(SphereMagic.CreatePlanet(PlanetItterations, radius, baseModule, heightMultiplier, regions), mapTexture);
        noiseMapUpdateAvailable = false;
    }
Beispiel #26
0
    public void GenerateMap()
    {
        float[,] noiseMap = Noise.GenerateNoiseMap(width, depth, scale, octaves, lacunarity, persistence);

        MapDisplay display = FindObjectOfType <MapDisplay>();

        // display.DrawNoiseMap(noiseMap);
        display.DrawTerrainTexture(noiseMap);
        display.GenerateMesh(noiseMap, scale, height);
    }
Beispiel #27
0
        void DrawToBitmap(MapDisplay mapdisplay, RectangleF clip)
        {
            Matrix inverse = transform.Clone();

            inverse.Invert();
            using (Region clipRegion = new Region(clip)) {
                clipRegion.Transform(inverse);
                mapdisplay.Draw(bitmap, transform, clipRegion);
            }
        }
    public void GenerateMapWithNoiseMap()
    {
        float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, seed, offSet, octaves, persistace, lacunarity, scale);


        MapDisplay mapDisplay = FindObjectOfType <MapDisplay>();

        Debug.Log("se accede a map display");
        mapDisplay.CreateMapUsingNoiseMap(noiseMap);
    }
    public void GenerateMap()
    {
        float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, seed, noiseScale, octaves, persistance, lacunarity, offset);

        Color[] colourMap = new Color[mapWidth * mapHeight];
        for (int y = 0; y < mapHeight; y++)
        {
            for (int x = 0; x < mapWidth; x++)
            {
                if (useFalloff)
                {
                    noiseMap[x, y] = Mathf.Clamp01(noiseMap[x, y] - falloffMap[x, y]);
                }

                if (useOverlay)
                {
                    noiseMap[x, y] = Mathf.Clamp01(noiseMap[x, y] - overlayMap[x, y]);
                }

                float currentHeight = noiseMap[x, y];
                for (int i = 0; i < regions.Length; i++)
                {
                    if (currentHeight <= regions[i].height)
                    {
                        colourMap[y * mapWidth + x] = regions[i].colour;

                        break;
                    }
                }
            }
        }

        MapDisplay display = FindObjectOfType <MapDisplay>();

        if (drawMode == DrawMode.NoiseMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromHeightMap(noiseMap));
        }
        else if (drawMode == DrawMode.ColourMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromColourMap(colourMap, mapWidth, mapHeight));
        }
        else if (drawMode == DrawMode.FalloffMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromHeightMap(FalloffGenerator.GenerateFalloffMap(mapHeight)));
        }
        else if (drawMode == DrawMode.Mesh)
        {
            display.DrawMesh(MeshGenerator.GenerateTerrainMesh(noiseMap), TextureGenerator.TextureFromColourMap(colourMap, mapWidth, mapHeight));
        }
        else if (drawMode == DrawMode.OverlayMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromHeightMap(OverlayGenerator.GenerateOverlayMap(mapHeight)));
        }
    }
Beispiel #30
0
 public static void Postfix(MapDisplay __instance)
 {
     if (!(bool)currentAreaHasMap.GetValue(__instance))
     {
         var minimap = __instance.LocalCharacter?.GetComponentInChildren <MinimapScript>();
         if (minimap)
         {
             minimap.OnShowBigMap();
         }
     }
 }
        // This is just to compare file sizes/quality of GIF vs. JPG.
        // [TestMethod]
        public void CompareFiles()
        {
            MapDisplay mapDisplay = new MapDisplay();
            string filenameJpeg = TestUtil.GetTestFile(@"routegadget\exporttest.jpg");
            string filenameGif = TestUtil.GetTestFile(@"routegadget\exporttest.gif");

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"routegadget\salmon_la_sac-20090625.ocd"));
            mapDisplay.AntiAlias = false;
            mapDisplay.MapIntensity = 0.3F;

            ExportBitmap exporter = new ExportBitmap(mapDisplay.Clone());
            exporter.CreateBitmap(filenameJpeg, RectangleF.FromLTRB(-90F, 10F, 60F, 105F), ImageFormat.Jpeg, 200F);
            exporter.CreateBitmap(filenameGif, RectangleF.FromLTRB(-90F, 10F, 60F, 105F), ImageFormat.Gif, 200F);
        }
Beispiel #32
0
        public void AntialiasOcadMap()
        {
            SetupBitmap();
            MapDisplay mapDisplay = new MapDisplay();

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"mapdisplay\SampleEvent.ocd"));
            mapDisplay.AntiAlias = true;
            mapDisplay.MapIntensity = 1.0F;

            RectangleF drawRect = RectangleF.FromLTRB(50F, 170F, 100F, 220F);
            DrawToBitmap(mapDisplay, drawRect);

            TestUtil.CompareBitmapBaseline(bitmap, TestUtil.GetTestFile(@"mapdisplay\AntialiasOcadMap.png"));
        }
Beispiel #33
0
 public void nextMapDisplay()
 {
     Array values = Enum.GetValues(typeof(MapDisplay));
     int index = Array.IndexOf(values, mapDisplay);
     index = (index+1) % values.Length;
     mapDisplay = (MapDisplay) values.GetValue(index);
 }
Beispiel #34
0
 private void buttonBrowse_Click(object sender, EventArgs e)
 {
     DialogResult result = openFileDialog.ShowDialog();
     if (result == DialogResult.OK) {
         mapDisplay = new MapDisplay();
         mapDisplay.SetMapFile(Path.GetExtension(openFileDialog.FileName) == ".ocd" ? MapType.OCAD : MapType.Bitmap, openFileDialog.FileName);
         mapDisplay.AntiAlias = antialiasCheckBox.Checked;
         mapDisplay.ShowSymbolBounds = showBoundsCheckBox.Checked;
         mapDisplay.MapIntensity = float.Parse(intensityCombo.Text);
         mapViewer.SetMap(mapDisplay);
     }
 }
Beispiel #35
0
 void DrawToBitmap(MapDisplay mapdisplay, RectangleF clip)
 {
     Matrix inverse = transform.Clone();
     inverse.Invert();
     using (Region clipRegion = new Region(clip)) {
         clipRegion.Transform(inverse);
         mapdisplay.Draw(bitmap, transform, clipRegion);
     }
 }
Beispiel #36
0
        public void OverprintOcadMap()
        {
            SetupBitmap();
            MapDisplay mapDisplay = new MapDisplay();

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"mapdisplay\overprint.ocd"));
            mapDisplay.AntiAlias = false;
            mapDisplay.MapIntensity = 1F;
            mapDisplay.OcadOverprintEffect = true;

            RectangleF drawRect = RectangleF.FromLTRB(50F, 170F, 100F, 220F);
            DrawToBitmap(mapDisplay, drawRect);

            TestUtil.CompareBitmapBaseline(bitmap, TestUtil.GetTestFile(@"mapdisplay\OverprintOcadMap.png"));
        }
Beispiel #37
0
        public void BitmapBounds()
        {
            MapDisplay mapDisplay = new MapDisplay();

            mapDisplay.SetMapFile(MapType.Bitmap, TestUtil.GetTestFile(@"mapdisplay\SampleEvent.jpg"));
            mapDisplay.Dpi = 300;
            TestUtil.AssertEqualRect(RectangleF.FromLTRB(0F, 0F, 201.08F, 269.16F), mapDisplay.MapBounds, 0.01F, "map bounds");
        }
        public void TestExportJpegAutoDpi3()
        {
            MapDisplay mapDisplay = new MapDisplay();
            string filename = TestUtil.GetTestFile(@"routegadget\exportjpeg4.jpg");
            string filenameBaseline = TestUtil.GetTestFile(@"routegadget\exportjpeg4_baseline.png");

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"routegadget\SampleEvent.ocd"));
            mapDisplay.AntiAlias = false;
            mapDisplay.MapIntensity = 0.3F;

            ExportBitmap exporter = new ExportBitmap(mapDisplay.Clone());
            exporter.CreateBitmapAutoDpi(filename, RectangleF.FromLTRB(0F, 70F, 600F, 600F), ImageFormat.Jpeg, 1700, 100, 200);

            Assert.IsFalse(mapDisplay.AntiAlias);
            Assert.AreEqual(0.3F, mapDisplay.MapIntensity);

            Bitmap bmLoaded = (Bitmap)Image.FromFile(filename);
            Assert.AreEqual(100F, bmLoaded.VerticalResolution);
            Assert.AreEqual(100F, bmLoaded.HorizontalResolution);

            TestUtil.CompareBitmapBaseline(bmLoaded, filenameBaseline);
            bmLoaded.Dispose();
            File.Delete(filename);
        }
        public void TestExportGif()
        {
            MapDisplay mapDisplay = new MapDisplay();
            string filename = TestUtil.GetTestFile(@"routegadget\exportgif1.gif");
            string filenameBaseline = TestUtil.GetTestFile(@"routegadget\exportgif1_baseline.png");

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"routegadget\SampleEvent.ocd"));
            mapDisplay.AntiAlias = false;
            mapDisplay.MapIntensity = 0.3F;

            ExportBitmap exporter = new ExportBitmap(mapDisplay.Clone());
            exporter.CreateBitmap(filename, RectangleF.FromLTRB(0F, 70F, 300F, 400F), ImageFormat.Gif, 200F);

            Assert.IsFalse(mapDisplay.AntiAlias);
            Assert.AreEqual(0.3F, mapDisplay.MapIntensity);

            Bitmap bmLoaded = (Bitmap) Image.FromFile(filename);

            TestUtil.CompareBitmapBaseline(bmLoaded, filenameBaseline);
            bmLoaded.Dispose();
            File.Delete(filename);
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RegionEditor));
     this.menuStrip1 = new System.Windows.Forms.MenuStrip();
     this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.mULFilePathToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.regionsxmlLocationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
     this.reloadRegionsFromFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.saveRegionsToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.compatible = new System.Windows.Forms.ToolStripMenuItem();
     this.label1 = new System.Windows.Forms.Label();
     this.facetList = new System.Windows.Forms.ComboBox();
     this.ShowMapButton = new System.Windows.Forms.Button();
     this.renderProgress = new System.Windows.Forms.ProgressBar();
     this.label2 = new System.Windows.Forms.Label();
     this.locationLabel = new System.Windows.Forms.Label();
     this.label3 = new System.Windows.Forms.Label();
     this.facetView = new System.Windows.Forms.TreeView();
     this.newRegion = new System.Windows.Forms.Button();
     this.modifyRegion = new System.Windows.Forms.Button();
     this.removeRegion = new System.Windows.Forms.Button();
     this.addSpawn = new System.Windows.Forms.Button();
     this.removeSpawn = new System.Windows.Forms.Button();
     this.addSubRegion = new System.Windows.Forms.Button();
     this.addArea = new System.Windows.Forms.Button();
     this.removeArea = new System.Windows.Forms.Button();
     this.areaModify = new System.Windows.Forms.Button();
     this.modifySpawn = new System.Windows.Forms.Button();
     this.label4 = new System.Windows.Forms.Label();
     this.label5 = new System.Windows.Forms.Label();
     this.goButton = new System.Windows.Forms.Button();
     this.clearFacet = new System.Windows.Forms.Button();
     this.goY = new Region_Editor.FilteredTextBox();
     this.goX = new Region_Editor.FilteredTextBox();
     this.scaleSlider = new Region_Editor.Slider();
     this.ySlider = new Region_Editor.Slider();
     this.xSlider = new Region_Editor.Slider();
     this.mapDisplay = new Region_Editor.MapDisplay();
     this.menuStrip1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.mapDisplay)).BeginInit();
     this.SuspendLayout();
     //
     // menuStrip1
     //
     this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.fileToolStripMenuItem,
     this.optionsToolStripMenuItem});
     this.menuStrip1.Location = new System.Drawing.Point(0, 0);
     this.menuStrip1.Name = "menuStrip1";
     this.menuStrip1.Size = new System.Drawing.Size(1008, 24);
     this.menuStrip1.TabIndex = 1;
     this.menuStrip1.Text = "menuStrip1";
     //
     // fileToolStripMenuItem
     //
     this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.mULFilePathToolStripMenuItem,
     this.regionsxmlLocationToolStripMenuItem,
     this.toolStripMenuItem1,
     this.reloadRegionsFromFileToolStripMenuItem,
     this.saveRegionsToFileToolStripMenuItem});
     this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
     this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
     this.fileToolStripMenuItem.Text = "&File";
     //
     // mULFilePathToolStripMenuItem
     //
     this.mULFilePathToolStripMenuItem.Name = "mULFilePathToolStripMenuItem";
     this.mULFilePathToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
     this.mULFilePathToolStripMenuItem.Text = "MUL File Path";
     this.mULFilePathToolStripMenuItem.Click += new System.EventHandler(this.mULFilePathToolStripMenuItem_Click);
     //
     // regionsxmlLocationToolStripMenuItem
     //
     this.regionsxmlLocationToolStripMenuItem.Name = "regionsxmlLocationToolStripMenuItem";
     this.regionsxmlLocationToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
     this.regionsxmlLocationToolStripMenuItem.Text = "Regions.xml Location";
     this.regionsxmlLocationToolStripMenuItem.Click += new System.EventHandler(this.regionsxmlLocationToolStripMenuItem_Click);
     //
     // toolStripMenuItem1
     //
     this.toolStripMenuItem1.Name = "toolStripMenuItem1";
     this.toolStripMenuItem1.Size = new System.Drawing.Size(204, 6);
     //
     // reloadRegionsFromFileToolStripMenuItem
     //
     this.reloadRegionsFromFileToolStripMenuItem.Name = "reloadRegionsFromFileToolStripMenuItem";
     this.reloadRegionsFromFileToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
     this.reloadRegionsFromFileToolStripMenuItem.Text = "Reload Regions From File";
     this.reloadRegionsFromFileToolStripMenuItem.Click += new System.EventHandler(this.reloadRegionsFromFileToolStripMenuItem_Click);
     //
     // saveRegionsToFileToolStripMenuItem
     //
     this.saveRegionsToFileToolStripMenuItem.Name = "saveRegionsToFileToolStripMenuItem";
     this.saveRegionsToFileToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
     this.saveRegionsToFileToolStripMenuItem.Text = "Save Regions To File";
     this.saveRegionsToFileToolStripMenuItem.Click += new System.EventHandler(this.saveRegionsToFileToolStripMenuItem_Click);
     //
     // optionsToolStripMenuItem
     //
     this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.compatible});
     this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
     this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
     this.optionsToolStripMenuItem.Text = "&Options";
     //
     // compatible
     //
     this.compatible.CheckOnClick = true;
     this.compatible.Name = "compatible";
     this.compatible.Size = new System.Drawing.Size(281, 22);
     this.compatible.Text = "Enable Compatibility with Older Clients";
     this.compatible.CheckedChanged += new System.EventHandler(this.compatible_CheckedChanged);
     //
     // label1
     //
     this.label1.AutoSize = true;
     this.label1.Location = new System.Drawing.Point(598, 35);
     this.label1.Name = "label1";
     this.label1.Size = new System.Drawing.Size(34, 13);
     this.label1.TabIndex = 11;
     this.label1.Text = "Facet";
     //
     // facetList
     //
     this.facetList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.facetList.FormattingEnabled = true;
     this.facetList.Items.AddRange(new object[] {
     "Felucca",
     "Trammel",
     "Ilshenar",
     "Malas",
     "Tokuno",
     "Ter Mur"});
     this.facetList.Location = new System.Drawing.Point(634, 31);
     this.facetList.Name = "facetList";
     this.facetList.Size = new System.Drawing.Size(121, 21);
     this.facetList.TabIndex = 12;
     this.facetList.TabStop = false;
     this.facetList.SelectedIndexChanged += new System.EventHandler(this.facetList_SelectedIndexChanged);
     //
     // ShowMapButton
     //
     this.ShowMapButton.Location = new System.Drawing.Point(761, 30);
     this.ShowMapButton.Name = "ShowMapButton";
     this.ShowMapButton.Size = new System.Drawing.Size(75, 23);
     this.ShowMapButton.TabIndex = 13;
     this.ShowMapButton.TabStop = false;
     this.ShowMapButton.Text = "Map Display";
     this.ShowMapButton.UseVisualStyleBackColor = true;
     this.ShowMapButton.Click += new System.EventHandler(this.ShowMapButton_Click);
     //
     // renderProgress
     //
     this.renderProgress.Location = new System.Drawing.Point(842, 30);
     this.renderProgress.Name = "renderProgress";
     this.renderProgress.Size = new System.Drawing.Size(157, 23);
     this.renderProgress.TabIndex = 14;
     this.renderProgress.Visible = false;
     //
     // label2
     //
     this.label2.AutoSize = true;
     this.label2.Location = new System.Drawing.Point(9, 622);
     this.label2.Name = "label2";
     this.label2.Size = new System.Drawing.Size(54, 13);
     this.label2.TabIndex = 2;
     this.label2.Text = "Location :";
     //
     // locationLabel
     //
     this.locationLabel.AutoSize = true;
     this.locationLabel.Location = new System.Drawing.Point(69, 622);
     this.locationLabel.Name = "locationLabel";
     this.locationLabel.Size = new System.Drawing.Size(25, 13);
     this.locationLabel.TabIndex = 3;
     this.locationLabel.Text = "0, 0";
     //
     // label3
     //
     this.label3.AutoSize = true;
     this.label3.Location = new System.Drawing.Point(388, 622);
     this.label3.Name = "label3";
     this.label3.Size = new System.Drawing.Size(58, 13);
     this.label3.TabIndex = 9;
     this.label3.Text = "Map Scale";
     //
     // facetView
     //
     this.facetView.Location = new System.Drawing.Point(601, 57);
     this.facetView.Name = "facetView";
     this.facetView.Size = new System.Drawing.Size(398, 513);
     this.facetView.TabIndex = 15;
     this.facetView.TabStop = false;
     this.facetView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.facetView_AfterSelect);
     this.facetView.DoubleClick += new System.EventHandler(this.facetView_DoubleClick);
     //
     // newRegion
     //
     this.newRegion.Location = new System.Drawing.Point(601, 570);
     this.newRegion.Name = "newRegion";
     this.newRegion.Size = new System.Drawing.Size(95, 23);
     this.newRegion.TabIndex = 16;
     this.newRegion.TabStop = false;
     this.newRegion.Text = "New Region";
     this.newRegion.UseVisualStyleBackColor = true;
     this.newRegion.Click += new System.EventHandler(this.newRegion_Click);
     //
     // modifyRegion
     //
     this.modifyRegion.Enabled = false;
     this.modifyRegion.Location = new System.Drawing.Point(803, 570);
     this.modifyRegion.Name = "modifyRegion";
     this.modifyRegion.Size = new System.Drawing.Size(95, 23);
     this.modifyRegion.TabIndex = 18;
     this.modifyRegion.TabStop = false;
     this.modifyRegion.Text = "Modify Region";
     this.modifyRegion.UseVisualStyleBackColor = true;
     this.modifyRegion.Click += new System.EventHandler(this.modifyRegion_Click);
     //
     // removeRegion
     //
     this.removeRegion.Enabled = false;
     this.removeRegion.Location = new System.Drawing.Point(904, 570);
     this.removeRegion.Name = "removeRegion";
     this.removeRegion.Size = new System.Drawing.Size(95, 23);
     this.removeRegion.TabIndex = 19;
     this.removeRegion.TabStop = false;
     this.removeRegion.Text = "Remove Region";
     this.removeRegion.UseVisualStyleBackColor = true;
     this.removeRegion.Click += new System.EventHandler(this.removeRegion_Click);
     //
     // addSpawn
     //
     this.addSpawn.Enabled = false;
     this.addSpawn.Location = new System.Drawing.Point(601, 595);
     this.addSpawn.Name = "addSpawn";
     this.addSpawn.Size = new System.Drawing.Size(95, 23);
     this.addSpawn.TabIndex = 20;
     this.addSpawn.TabStop = false;
     this.addSpawn.Text = "Add Spawn";
     this.addSpawn.UseVisualStyleBackColor = true;
     this.addSpawn.Click += new System.EventHandler(this.addSpawn_Click);
     //
     // removeSpawn
     //
     this.removeSpawn.Enabled = false;
     this.removeSpawn.Location = new System.Drawing.Point(803, 595);
     this.removeSpawn.Name = "removeSpawn";
     this.removeSpawn.Size = new System.Drawing.Size(95, 23);
     this.removeSpawn.TabIndex = 22;
     this.removeSpawn.TabStop = false;
     this.removeSpawn.Text = "Remove Spawn";
     this.removeSpawn.UseVisualStyleBackColor = true;
     this.removeSpawn.Click += new System.EventHandler(this.removeSpawn_Click);
     //
     // addSubRegion
     //
     this.addSubRegion.Enabled = false;
     this.addSubRegion.Location = new System.Drawing.Point(702, 570);
     this.addSubRegion.Name = "addSubRegion";
     this.addSubRegion.Size = new System.Drawing.Size(95, 23);
     this.addSubRegion.TabIndex = 17;
     this.addSubRegion.TabStop = false;
     this.addSubRegion.Text = "Add SubRegion";
     this.addSubRegion.UseVisualStyleBackColor = true;
     this.addSubRegion.Click += new System.EventHandler(this.addSubRegion_Click);
     //
     // addArea
     //
     this.addArea.Enabled = false;
     this.addArea.Location = new System.Drawing.Point(904, 595);
     this.addArea.Name = "addArea";
     this.addArea.Size = new System.Drawing.Size(95, 23);
     this.addArea.TabIndex = 23;
     this.addArea.TabStop = false;
     this.addArea.Text = "Add Area";
     this.addArea.UseVisualStyleBackColor = true;
     this.addArea.Click += new System.EventHandler(this.addArea_Click);
     //
     // removeArea
     //
     this.removeArea.Enabled = false;
     this.removeArea.Location = new System.Drawing.Point(702, 620);
     this.removeArea.Name = "removeArea";
     this.removeArea.Size = new System.Drawing.Size(95, 23);
     this.removeArea.TabIndex = 25;
     this.removeArea.TabStop = false;
     this.removeArea.Text = "Remove Area";
     this.removeArea.UseVisualStyleBackColor = true;
     this.removeArea.Click += new System.EventHandler(this.removeArea_Click);
     //
     // areaModify
     //
     this.areaModify.Enabled = false;
     this.areaModify.Location = new System.Drawing.Point(601, 620);
     this.areaModify.Name = "areaModify";
     this.areaModify.Size = new System.Drawing.Size(95, 23);
     this.areaModify.TabIndex = 24;
     this.areaModify.TabStop = false;
     this.areaModify.Text = "Modify Area";
     this.areaModify.UseVisualStyleBackColor = true;
     this.areaModify.Click += new System.EventHandler(this.areaModify_Click);
     //
     // modifySpawn
     //
     this.modifySpawn.Enabled = false;
     this.modifySpawn.Location = new System.Drawing.Point(702, 595);
     this.modifySpawn.Name = "modifySpawn";
     this.modifySpawn.Size = new System.Drawing.Size(95, 23);
     this.modifySpawn.TabIndex = 21;
     this.modifySpawn.TabStop = false;
     this.modifySpawn.Text = "Modify Spawn";
     this.modifySpawn.UseVisualStyleBackColor = true;
     this.modifySpawn.Click += new System.EventHandler(this.modifySpawn_Click);
     //
     // label4
     //
     this.label4.AutoSize = true;
     this.label4.Location = new System.Drawing.Point(154, 621);
     this.label4.Name = "label4";
     this.label4.Size = new System.Drawing.Size(14, 13);
     this.label4.TabIndex = 4;
     this.label4.Text = "X";
     //
     // label5
     //
     this.label5.AutoSize = true;
     this.label5.Location = new System.Drawing.Point(213, 621);
     this.label5.Name = "label5";
     this.label5.Size = new System.Drawing.Size(14, 13);
     this.label5.TabIndex = 6;
     this.label5.Text = "Y";
     //
     // goButton
     //
     this.goButton.Location = new System.Drawing.Point(271, 616);
     this.goButton.Name = "goButton";
     this.goButton.Size = new System.Drawing.Size(32, 23);
     this.goButton.TabIndex = 8;
     this.goButton.Text = "Go";
     this.goButton.UseVisualStyleBackColor = true;
     this.goButton.Click += new System.EventHandler(this.goButton_Click);
     //
     // clearFacet
     //
     this.clearFacet.Location = new System.Drawing.Point(904, 620);
     this.clearFacet.Name = "clearFacet";
     this.clearFacet.Size = new System.Drawing.Size(95, 23);
     this.clearFacet.TabIndex = 26;
     this.clearFacet.TabStop = false;
     this.clearFacet.Text = "Clear Facet";
     this.clearFacet.UseVisualStyleBackColor = true;
     this.clearFacet.Click += new System.EventHandler(this.clearFacet_Click);
     //
     // goY
     //
     this.goY.AllowedChars = "1234567890";
     this.goY.Location = new System.Drawing.Point(233, 617);
     this.goY.MaxLength = 4;
     this.goY.Name = "goY";
     this.goY.Size = new System.Drawing.Size(32, 20);
     this.goY.TabIndex = 7;
     //
     // goX
     //
     this.goX.AllowedChars = "1234567890";
     this.goX.Location = new System.Drawing.Point(174, 617);
     this.goX.MaxLength = 4;
     this.goX.Name = "goX";
     this.goX.Size = new System.Drawing.Size(32, 20);
     this.goX.TabIndex = 5;
     //
     // scaleSlider
     //
     this.scaleSlider.Location = new System.Drawing.Point(452, 617);
     this.scaleSlider.Maximum = 6;
     this.scaleSlider.MaximumSize = new System.Drawing.Size(1000, 22);
     this.scaleSlider.MinimumSize = new System.Drawing.Size(100, 22);
     this.scaleSlider.Name = "scaleSlider";
     this.scaleSlider.Size = new System.Drawing.Size(100, 22);
     this.scaleSlider.TabIndex = 10;
     this.scaleSlider.TabStop = false;
     this.scaleSlider.Value = 6;
     this.scaleSlider.SliderMoveComplete += new System.EventHandler(this.scaleSlider_SliderMoveComplete);
     //
     // ySlider
     //
     this.ySlider.Location = new System.Drawing.Point(558, 30);
     this.ySlider.MaximumSize = new System.Drawing.Size(22, 1000);
     this.ySlider.MinimumSize = new System.Drawing.Size(22, 100);
     this.ySlider.Name = "ySlider";
     this.ySlider.Orientation = System.Windows.Forms.Orientation.Vertical;
     this.ySlider.Size = new System.Drawing.Size(22, 540);
     this.ySlider.SmallChange = 5;
     this.ySlider.TabIndex = 0;
     this.ySlider.TabStop = false;
     this.ySlider.ValueChanged += new System.EventHandler(this.Slider_ValueChanged);
     this.ySlider.SliderMoveComplete += new System.EventHandler(this.Slider_SliderMoveComplete);
     //
     // xSlider
     //
     this.xSlider.Location = new System.Drawing.Point(12, 576);
     this.xSlider.MaximumSize = new System.Drawing.Size(1024, 22);
     this.xSlider.MinimumSize = new System.Drawing.Size(100, 22);
     this.xSlider.Name = "xSlider";
     this.xSlider.Size = new System.Drawing.Size(540, 22);
     this.xSlider.SmallChange = 5;
     this.xSlider.TabIndex = 1;
     this.xSlider.TabStop = false;
     this.xSlider.ValueChanged += new System.EventHandler(this.Slider_ValueChanged);
     this.xSlider.SliderMoveComplete += new System.EventHandler(this.Slider_SliderMoveComplete);
     //
     // mapDisplay
     //
     this.mapDisplay.Location = new System.Drawing.Point(12, 30);
     this.mapDisplay.MapScale = Region_Editor.Scaling.Scale30;
     this.mapDisplay.Name = "mapDisplay";
     this.mapDisplay.Size = new System.Drawing.Size(540, 540);
     this.mapDisplay.TabIndex = 6;
     this.mapDisplay.TabStop = false;
     this.mapDisplay.HoverCoordinatedChanged += new System.EventHandler(this.mapDisplay_HoverCoordinatedChanged);
     //
     // RegionEditor
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize = new System.Drawing.Size(1008, 644);
     this.Controls.Add(this.clearFacet);
     this.Controls.Add(this.goButton);
     this.Controls.Add(this.label5);
     this.Controls.Add(this.goY);
     this.Controls.Add(this.label4);
     this.Controls.Add(this.goX);
     this.Controls.Add(this.modifySpawn);
     this.Controls.Add(this.areaModify);
     this.Controls.Add(this.removeArea);
     this.Controls.Add(this.addArea);
     this.Controls.Add(this.addSubRegion);
     this.Controls.Add(this.removeSpawn);
     this.Controls.Add(this.addSpawn);
     this.Controls.Add(this.removeRegion);
     this.Controls.Add(this.modifyRegion);
     this.Controls.Add(this.newRegion);
     this.Controls.Add(this.facetView);
     this.Controls.Add(this.label3);
     this.Controls.Add(this.scaleSlider);
     this.Controls.Add(this.ySlider);
     this.Controls.Add(this.xSlider);
     this.Controls.Add(this.locationLabel);
     this.Controls.Add(this.label2);
     this.Controls.Add(this.mapDisplay);
     this.Controls.Add(this.renderProgress);
     this.Controls.Add(this.ShowMapButton);
     this.Controls.Add(this.facetList);
     this.Controls.Add(this.label1);
     this.Controls.Add(this.menuStrip1);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MainMenuStrip = this.menuStrip1;
     this.MaximizeBox = false;
     this.MinimizeBox = false;
     this.Name = "RegionEditor";
     this.Text = "Region Editor v2.0";
     this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RegionEditor_FormClosing);
     this.menuStrip1.ResumeLayout(false);
     this.menuStrip1.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.mapDisplay)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Beispiel #41
0
        public void CloneOcad()
        {
            MapDisplay mapDisplay = new MapDisplay();

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"mapdisplay\SampleEvent.ocd"));
            mapDisplay.AntiAlias = false;
            mapDisplay.MapIntensity = 0.3F;

            MapDisplay cloned = mapDisplay.Clone();

            RectangleF drawRect = RectangleF.FromLTRB(50F, 170F, 100F, 220F);

            SetupBitmap();
            cloned.AntiAlias = true;
            cloned.MapIntensity = 1.0F;
            DrawToBitmap(cloned, drawRect);

            TestUtil.CompareBitmapBaseline(bitmap, TestUtil.GetTestFile(@"mapdisplay\ClonedOcadMap.png"));

            SetupBitmap();
            DrawToBitmap(mapDisplay, drawRect);

            TestUtil.CompareBitmapBaseline(bitmap, TestUtil.GetTestFile(@"mapdisplay\NonclonedOcadMap.png"));
        }
Beispiel #42
0
        public void OcadBoundsScale()
        {
            MapDisplay mapDisplay = new MapDisplay() ;

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"mapdisplay\SampleEvent.ocd"));
            Assert.AreEqual(15000, mapDisplay.MapScale);
            TestUtil.AssertEqualRect(RectangleF.FromLTRB(-0.22F, 0.01F, 199.85F, 267.8F), mapDisplay.MapBounds, 0.01F, "map bounds");
        }
        private void CoursePrintingTest(string basename, CoursePrintSettings coursePrintSettings, CourseAppearance appearance, float dpi = 200)
        {
            GC.Collect();

            // Get the map display
            MapDisplay mapDisplay = new MapDisplay();
            mapDisplay.MapIntensity = 0.6F;
            mapDisplay.AntiAlias = true;
            mapDisplay.SetMapFile(controller.MapType, controller.MapFileName);
            if (controller.MapType == MapType.Bitmap)
                mapDisplay.Dpi = controller.MapDpi;
            mapDisplay.OcadOverprintEffect = appearance.useOcadOverprint;

            // Get the pages of the printing.
            CoursePrinting coursePrinter = new CoursePrinting(controller.GetEventDB(), ui.symbolDB, controller, mapDisplay.CloneToFullIntensity(), coursePrintSettings, appearance);
            Bitmap[] bitmaps = coursePrinter.PrintBitmaps();

            // Check all the pages against the baseline.
            for (int page = 0; page < bitmaps.Length; ++page) {
                Bitmap bm = bitmaps[page];
                string baseFileName = basename + "_page" + (page + 1).ToString();
                TestUtil.CheckBitmapsBase(bm, baseFileName);
                bm.Dispose();
            }

            // Only OCAD maps can be printed in XPS mode.
            if (controller.MapType == MapType.OCAD) {
                // Get the pages of the printing in XPS/WPF mode
                System.Windows.Media.Imaging.BitmapSource[] xpsBitmaps = coursePrinter.PrintXpsBitmaps(dpi);

                // Check all the pages against the baseline.
                for (int page = 0; page < xpsBitmaps.Length; ++page) {
                    var bm = xpsBitmaps[page];
                    string baseFileName = basename + "_xps_page" + (page + 1).ToString();
                    string newFileName = TestUtil.GetTestFile(basename + "_xps_page" + (page + 1).ToString() + "_new");
                    WritePng(bm, newFileName);
                    Bitmap newBitmap = (Bitmap)Image.FromFile(newFileName);

                    // For some reason, the XPS anti-aliasing varies slightly. Allow pixel difference to account.
                    TestUtil.CheckBitmapsBase(newBitmap, baseFileName, 19);
                }
            }
        }
Beispiel #44
0
        public void BasicBitmapMap()
        {
            SetupBitmap();
            MapDisplay mapDisplay = new MapDisplay();

            mapDisplay.SetMapFile(MapType.Bitmap, TestUtil.GetTestFile(@"mapdisplay\SampleEvent.jpg"));
            mapDisplay.Dpi = 300;
            mapDisplay.AntiAlias = false;
            mapDisplay.MapIntensity = 1.0F;

            RectangleF drawRect = RectangleF.FromLTRB(50F, 170F, 100F, 220F);
            DrawToBitmap(mapDisplay, drawRect);

            TestUtil.CompareBitmapBaseline(bitmap, TestUtil.GetTestFile(@"mapdisplay\BasicBitmapMap.png"));
        }