public void updateRoverSlideTargetPosition(int x, int y)
        {
            if ((x > 0) && (y > 0))
            {
                if ((x < navigationMapManager.getHazardWidth()) && (y < navigationMapManager.getHazardHeight()))
                {

                    BitmapHelper bH = new BitmapHelper(roverSlideBitmap);
                    bH.LockBitmap();

                    x = x * navigationMapManager.getHazardSectorSize();
                    y = y * navigationMapManager.getHazardSectorSize();

                    int size =  (int)((float)navigationMapManager.getAreaSize() * 0.02f);
                    System.Drawing.Color color = System.Drawing.Color.BlueViolet;
                    for (int a = (x - (size / 2)); a < (x + (size / 2)); a++)
                    {
                        for (int b = (y - (size / 2)); b < (y + (size / 2)); b++)
                        {
                            if ((a > 0) && (b > 0))
                            {
                                if ((a < roverSlideBitmap.Width) && (b < roverSlideBitmap.Height))
                                {
                                    bH.SetPixel(a, b, color);
                                }
                            }
                        }
                    }

                    bH.UnlockBitmap();
                    roverSlideBitmap = bH.Bitmap;
                }
            }
        }
        private void generateHazardImage()
        {
            int slopeX = 0;
            int slopeY = 0;

            Bitmap bitmap = new Bitmap(slopeWidth, slopeHeight);
            BitmapHelper bMap = new BitmapHelper(bitmap);
            bMap.LockBitmap();

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    System.Drawing.Color tempColor = getHazardColorValue(hazardModelImage[x, y]);

                    bMap.SetPixel(slopeX, slopeY, tempColor);
                    for (int a = 0; a < sectorSize; a++)
                    {
                        for (int b = 0; b < sectorSize; b++)
                        {
                            bMap.SetPixel(slopeX + a, slopeY + b, tempColor);
                        }
                    }

                    slopeY += sectorSize;
                }
                slopeY = 0;
                slopeX += sectorSize;
            }

            bMap.UnlockBitmap();

            hazardBitmap = bMap.Bitmap;
        }
예제 #3
0
        public void generatePathImage()
        {
            if ((map.getAdjustWidth() > 0) && (map.getAdjustHeight() > 0))
            {
                pathBitmap = new Bitmap(map.getAdjustWidth(), map.getAdjustHeight());

                BitmapHelper b = new BitmapHelper(pathBitmap);
                b.LockBitmap();

                for (int x = map.getMinX(); x < map.getMaxX(); x++)
                {
                    for (int y = map.getMinY(); y < map.getMaxY(); y++)
                    {
                        float t = (float)(x - map.getMinX()) / map.getAdjustWidth();
                        int a = (int)Math.Round((double)t * (double)map.getAdjustWidth());

                        t = (float)(y - map.getMinY()) / map.getAdjustHeight();
                        int ba = (int)Math.Round((double)t * (double)map.getAdjustHeight());

                        System.Drawing.Color tempColor = getVehicleColorValue(map.getValue(x, y), x, y);
                        b.SetPixel(a, ba, tempColor);
                    }
                }

                b.UnlockBitmap();
                pathBitmap = b.Bitmap;
            }
        }