Ejemplo n.º 1
0
 public void setData(DataPoint[] dataPoints)
 {
     transforms = new Matrix[dataPoints.Length];
       Color[] colors = new Color[dataPoints.Length];
       for (int i = 0; i < dataPoints.Length; i++) {
     DataPoint point = dataPoints[i];
     transforms[i] = Matrix.CreateScale(1, 1, point.value) * PreOffset
       * VisualHelper.LatLngRotation(point.lat, point.lng);
     colors[i] = point.value == 0 ? Invisible : VisualHelper.hueToColor((1 - point.value) / 2);
       }
       GenerateInstanceInformation(GraphicsDevice, transforms, colors);
       bindings = new VertexBufferBinding[2];
       bindings[0] = new VertexBufferBinding(useTile ? tileGeometryBuffer : geometryBuffer);
       bindings[1] = new VertexBufferBinding(instanceBuffer, 0, 1);
 }
Ejemplo n.º 2
0
        public static void Normalize(DataPoint[] points)
        {
            float min = float.MaxValue;
              float max = float.MinValue;
              foreach (DataPoint point in points) {
            if (point.value > max) {
              max = point.value;
            }
            if (point.value < min) {
              min = point.value;
            }
              }

              foreach (DataPoint point in points) {
            point.value -= min;
            point.value /= max;
              }
        }
Ejemplo n.º 3
0
 public void setData(DataPoint[] dataPoints)
 {
     data.setData(dataPoints);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
              spriteBatch = new SpriteBatch(GraphicsDevice);

              // Create a new model
              DataPoint[] data = new DataPoint[360 * 180];
              for (int lng = 0; lng < 360; lng ++) {
            for (int lat = 0; lat < 180; lat ++) {
              int ind = lng * 180 + lat;
              data[ind] = new DataPoint(lat - 90, lng - 180, 0);
            }
              }
              List<DataPoint> dataList = new List<DataPoint>();

              //model = new GlobeModel(Content, GraphicsDevice, Matrix.CreateTranslation(offsetX, offsetY, offsetZ));

              //string line;
              //StreamReader file = new StreamReader("earthquake.tsv");
              //while ((line = file.ReadLine()) != null) {
              //  string[] parts = line.Split(' ');
              //  int lat = (int)(float.Parse(parts[0]) + .5f);
              //  int lng = (int)(float.Parse(parts[1]) + .5f);
              //  int ind = (lng >= 180 ? 0 : lng + 180) * 180 + (lat + 90);
              //  data[ind].value++;
              //  dataList.Add(new DataPoint(float.Parse(parts[0]), float.Parse(parts[1]), float.Parse(parts[2]) / 9.5f));
              //}
              //dataList.Clear();
              //dataList.Add(new DataPoint(35.673343f, 139.710388f, 1));
              //data = dataList.ToArray();
              //model.setData(data);

              aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

              // Set cullmode
              RasterizerState rs = new RasterizerState();
              rs.CullMode = CullMode.CullCounterClockwiseFace;
              GraphicsDevice.RasterizerState = rs;

              if (ENABLE_KINECT) {
            manager = new KinectManager("out.txt", CONTINUE_TRACK);
              }
        }