Ejemplo n.º 1
0
 public GeometricGraph(MemoryMap map, GeometricGraphProfile profile, int edgeDataSize, int size)
 {
     if (profile == null)
     {
         this._graph       = new Graph(map, edgeDataSize, (long)size);
         this._coordinates = (ArrayBase <float>) new Array <float>(map, (long)(size * 2));
         for (int index = 0; (long)index < this._coordinates.Length; ++index)
         {
             this._coordinates[(long)index] = float.MaxValue;
         }
         this._shapes = new ShapesArray(map, (long)size);
     }
     else
     {
         this._graph       = new Graph(map, profile.GraphProfile, edgeDataSize, (long)size);
         this._coordinates = (ArrayBase <float>) new Array <float>(map, (long)(size * 2), profile.CoordinatesProfile);
         for (int index = 0; (long)index < this._coordinates.Length; ++index)
         {
             this._coordinates[(long)index] = float.MaxValue;
         }
         this._shapes = new ShapesArray(map, (long)size);
     }
 }
Ejemplo n.º 2
0
        public static GeometricGraph Deserialize(Stream stream, GeometricGraphProfile profile)
        {
            int num1 = stream.ReadByte();

            if (num1 != 1)
            {
                throw new Exception(string.Format("Cannot deserialize geometric graph: Invalid version #: {0}.", (object)num1));
            }
            Graph             graph     = Graph.Deserialize(stream, profile == null ? (GraphProfile)null : profile.GraphProfile);
            long              position1 = stream.Position;
            long              num2      = 0;
            ArrayBase <float> coordinates;
            ShapesArray       from;
            long              num3;

            if (profile == null)
            {
                coordinates = (ArrayBase <float>) new MemoryArray <float>((long)(graph.VertexCount * 2U));
                coordinates.CopyFrom(stream);
                long num4 = num2 + (long)(uint)((int)graph.VertexCount * 2 * 4);
                long size;
                from = ShapesArray.CreateFrom(stream, true, out size);
                num3 = num4 + size;
            }
            else
            {
                long position2 = stream.Position;
                coordinates = (ArrayBase <float>) new Array <float>(((MemoryMap) new MemoryMapStream((Stream) new CappedStream(stream, position2, (long)(uint)((int)graph.VertexCount * 4 * 2)))).CreateSingle((long)(graph.VertexCount * 2U)), profile.CoordinatesProfile);
                long num4 = num2 + (long)(uint)((int)graph.VertexCount * 2 * 4);
                stream.Seek(position2 + (long)(uint)((int)graph.VertexCount * 4 * 2), SeekOrigin.Begin);
                long size;
                from = ShapesArray.CreateFrom(stream, false, out size);
                num3 = num4 + size;
            }
            stream.Seek(position1 + num3, SeekOrigin.Begin);
            return(new GeometricGraph(graph, coordinates, from));
        }
Ejemplo n.º 3
0
 public GeometricGraph(MemoryMap map, GeometricGraphProfile profile, int edgeDataSize)
     : this(map, profile, edgeDataSize, 1024)
 {
 }