public async Task <IActionResult> Edit(int id, [Bind("Path,ServiceId,Name,Id")] LayerRecord layerRecord)
        {
            if (id != layerRecord.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    ConfigContext.Update(layerRecord);
                    await ConfigContext.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LayerRecordExists(layerRecord.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ServiceId"] = new SelectList(ConfigContext.Services, "Id", "Id", layerRecord.ServiceId);
            return(View(layerRecord));
        }
Ejemplo n.º 2
0
        protected async Task <LayerRecord> GetLayerRecord(string serviceName, string version, string layerName)
        {
            ServiceRecord serviceRecord = await GetServiceRecord(serviceName, version);

            LayerRecord layerRecord = await GetLayerRecord(serviceRecord, layerName);

            return(layerRecord);
        }
Ejemplo n.º 3
0
        public override bool OnLayer(AnimatorControllerLayer layer, int lNum)
        {
            LayerRecord layerRecord = new LayerRecord(
                lNum,
                layer);

            AconDocument.layers.Add(layerRecord); return(true);
        }
Ejemplo n.º 4
0
        public static ColrTable Load(BigEndianBinaryReader reader)
        {
            // HEADER

            // Type      | Name                   | Description
            // ----------|------------------------|----------------------------------------------------------------------------------------------------
            // uint16    | version                | Table version number(starts at 0).
            // uint16    | numBaseGlyphRecords    | Number of Base Glyph Records.
            // Offset32  | baseGlyphRecordsOffset | Offset(from beginning of COLR table) to Base Glyph records.
            // Offset32  | layerRecordsOffset     | Offset(from beginning of COLR table) to Layer Records.
            // uint16    | numLayerRecords        | Number of Layer Records.

            // Base Glyph Record
            // Type      | Name                   | Description
            // ----------|------------------------|----------------------------------------------------------------------------------------------------
            // uint16    | gID                    | Glyph ID of reference glyph. This glyph is for reference only and is not rendered for color.
            // uint16    | firstLayerIndex        | Index(from beginning of the Layer Records) to the layer record. There will be numLayers consecutive entries for this base glyph.
            // uint16    | numLayers              | Number of color layers associated with this glyph.

            // Layer Record
            // Type      | Name                   | Description
            // ----------|------------------------|----------------------------------------------------------------------------------------------------
            // uint16    | gID                    | Glyph ID of layer glyph (must be in z-order from bottom to top).
            // uint16    | paletteIndex           | Index value to use with a selected color palette. This value must be less than numPaletteEntries in
            //           |                        | > the CPAL table. A palette entry index value of 0xFFFF is a special case indicating that the text
            //           |                        | > foreground color (defined by a higher-level client) should be used and shall not be treated as
            //           |                        | > actual index into CPAL ColorRecord array.
            var version                = reader.ReadUInt16();
            var numBaseGlyphRecords    = reader.ReadUInt16();
            var baseGlyphRecordsOffset = reader.ReadOffset32();
            var layerRecordsOffset     = reader.ReadOffset32();
            var numLayerRecords        = reader.ReadUInt16();

            reader.Seek(baseGlyphRecordsOffset, System.IO.SeekOrigin.Begin);

            var glyphs = new BaseGlyphRecord[numBaseGlyphRecords];
            var layers = new LayerRecord[numLayerRecords];

            for (var i = 0; i < numBaseGlyphRecords; i++)
            {
                var gi  = reader.ReadUInt16();
                var idx = reader.ReadUInt16();
                var num = reader.ReadUInt16();
                glyphs[i] = new BaseGlyphRecord(gi, idx, num);
            }

            reader.Seek(layerRecordsOffset, System.IO.SeekOrigin.Begin);

            for (var i = 0; i < numLayerRecords; i++)
            {
                var gi = reader.ReadUInt16();
                var pi = reader.ReadUInt16();
                layers[i] = new LayerRecord(gi, pi);
            }

            return(new ColrTable(glyphs, layers));
        }
Ejemplo n.º 5
0
        protected async Task <LayerRecord> GetLayerRecord(ServiceRecord serviceRecord, string layerName)
        {
            LayerRecord layerRecord = null;

            if (serviceRecord != null && !string.IsNullOrWhiteSpace(layerName))
            {
                layerRecord = await ConfigContext.Layers.FirstOrDefaultAsync(x => x.ServiceId == serviceRecord.Id && x.Name == layerName);
            }
            return(layerRecord);
        }
        public async Task <IActionResult> Create([Bind("Path,ServiceId,Name,Id")] LayerRecord layerRecord)
        {
            if (ModelState.IsValid)
            {
                ConfigContext.Add(layerRecord);
                await ConfigContext.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ServiceId"] = new SelectList(ConfigContext.Services, "Id", "Id", layerRecord.ServiceId);
            return(View(layerRecord));
        }
Ejemplo n.º 7
0
        private async Task <bool> AddLayerRecord(ServiceRecord serviceRecord, string layerName, string layerPath)
        {
            LayerRecord layerRecord = new LayerRecord()
            {
                Name    = layerName,
                Service = serviceRecord,
                Path    = layerPath
            };
            await _configContext.Layers.AddAsync(layerRecord);

            int result = await _configContext.SaveChangesAsync();

            bool ret = result > 0;

            return(ret);
        }
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            LayerRecord layerRecord = await ConfigContext.Layers.FindAsync(id);

            if (layerRecord == null)
            {
                return(NotFound("未找到图层"));
            }
            ServiceRecord serviceRecord = await ConfigContext.Services.FindAsync(layerRecord.ServiceId);

            if (serviceRecord == null)
            {
                return(StatusCode(500));
            }

            string capabilitiesPath = ServicePathManager.GetCapabilitiesPath(serviceRecord.Type, serviceRecord.Version, serviceRecord.Name);
            await OgcServiceHelper.RemoveLayerFromCapabilities(serviceRecord, capabilitiesPath, layerRecord);

            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 9
0
        private async Task <ContentResult> GetFeatureInfo(string serviceName, GetFeatureInfo getFeatureInfo)
        {
            GetTile         getTile    = getFeatureInfo.GetTile;
            string          content    = null;
            ExceptionReport exception  = null;
            int             statusCode = 200;

            #region Validate parameters
            if (string.IsNullOrWhiteSpace(serviceName))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "serviceName", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string serviceType = getTile.service;
            if (string.IsNullOrWhiteSpace(serviceType))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "service", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            if (serviceType != "wmts")
            {
                exception  = ExceptionReportHelper.GetExceptionReport("InvalidParameterValue", "version", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string version = getTile.version;
            if (string.IsNullOrWhiteSpace(version))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "version", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            if (version != "1.0.0")
            {
                exception  = ExceptionReportHelper.GetExceptionReport("InvalidParameterValue", "version", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string layerName = getTile.Layer;
            if (string.IsNullOrWhiteSpace(layerName))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "layer", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string style = getTile.Style;
            if (string.IsNullOrWhiteSpace(style))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "style", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string format = getTile.Format;
            if (string.IsNullOrWhiteSpace(format))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "format", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string tileMatrixSet = getTile.TileMatrixSet;
            if (string.IsNullOrWhiteSpace(tileMatrixSet))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "tileMatrixSet", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string tileMatrix = getTile.TileMatrix;
            if (string.IsNullOrWhiteSpace(tileMatrix))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "tileMatrix", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            ServiceRecord serviceRecord = await GetServiceRecord(serviceName, version);

            if (serviceRecord == null)
            {
                exception  = ExceptionReportHelper.GetExceptionReport("InvalidParameterValue", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            if (!System.IO.File.Exists(serviceRecord.Path))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                statusCode = 500;
                goto Exception;
            }
            LayerRecord layerRecord = await GetLayerRecord(serviceRecord, layerName);

            if (layerRecord == null)
            {
                exception  = ExceptionReportHelper.GetExceptionReport("InvalidParameterValue", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            if (!System.IO.File.Exists(layerRecord.Path))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                statusCode = 500;
                goto Exception;
            }
            #endregion
            GetCapabilities getCapabilities = new GetCapabilities();
            IWmtsService    wmts1Service    = GetWmts1Service(version);
            Capabilities    capabilities    = wmts1Service.GetCapabilities(serviceRecord.Path, getCapabilities);
            if (capabilities == null)
            {
                exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                statusCode = 500;
                goto Exception;
            }
            LayerType layerType = capabilities.Contents?.DatasetDescriptionSummary?.FirstOrDefault(x => x.Identifier?.Value == layerName && x is LayerType) as LayerType;
            if (layerType == null)
            {
                exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                statusCode = 500;
                goto Exception;
            }
            if (!layerType.Format.Contains(format))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("InvalidParameterValue", "format", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            if (layerType.TileMatrixSetLink == null || layerType.TileMatrixSetLink.Length == 0)
            {
                exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                statusCode = 500;
                goto Exception;
            }
            string layerTileMatrixSetStr = layerType.TileMatrixSetLink[0].TileMatrixSet;
            if (layerTileMatrixSetStr != null)
            {
                TileMatrixSet layerTileMatrixSet = capabilities.Contents.TileMatrixSet?.FirstOrDefault(x => x.Identifier?.Value == layerTileMatrixSetStr);
                if (layerTileMatrixSet != null)
                {
                    TileMatrix layerTileMatrix = layerTileMatrixSet.TileMatrix?.FirstOrDefault(x => x.Identifier.Value == getTile.TileMatrix);
                    if (layerTileMatrix != null)
                    {
                        bool ret = layerTileMatrix.TopLeftCorner.ToPosition(out double left, out double top);
                        if (!ret)
                        {
                            exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                            statusCode = 500;
                            goto Exception;
                        }
                        BoundingBoxType boundingBoxType = layerType.BoundingBox?.Length > 0 ? layerType.BoundingBox[0] : layerType.WGS84BoundingBox?.Length > 0 ? layerType.WGS84BoundingBox[0] : null;
                        if (boundingBoxType == null)
                        {
                            exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                            statusCode = 500;
                            goto Exception;
                        }
                        bool ret1 = boundingBoxType.LowerCorner.ToPosition(out double xMin, out double yMin);
                        bool ret2 = boundingBoxType.UpperCorner.ToPosition(out double xMax, out double yMax);
                        if (!ret1 || !ret2)
                        {
                            exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                            statusCode = 500;
                            goto Exception;
                        }
                        double tileXMin = 0, tileYMin = 0, tileXMax = 0, tileYMax = 0;
                        int    tileWidth  = Convert.ToInt32(layerTileMatrix.TileWidth);
                        int    tileHeight = Convert.ToInt32(layerTileMatrix.TileHeight);
                        tileXMin = left + getTile.TileCol * tileWidth * layerTileMatrix.ScaleDenominator;
                        tileXMax = left + (getTile.TileCol + 1) * tileWidth * layerTileMatrix.ScaleDenominator;
                        tileYMax = top - getTile.TileRow * tileHeight * layerTileMatrix.ScaleDenominator;
                        tileYMin = top - (getTile.TileRow + 1) * tileHeight * layerTileMatrix.ScaleDenominator;
                        if (tileXMax <= xMin || tileXMin >= xMax || tileYMax <= yMin || tileYMin >= yMax)
                        {
                            exception  = ExceptionReportHelper.GetExceptionReport("TileOutOfRange", exceptionText: "Bad request");
                            statusCode = 400;
                            goto Exception;
                        }
                        if (getFeatureInfo.I < 0 || getFeatureInfo.I >= tileWidth || getFeatureInfo.J < 0 || getFeatureInfo.J >= tileHeight)
                        {
                            exception  = ExceptionReportHelper.GetExceptionReport("PointIJOutOfRange", exceptionText: "Bad request");
                            statusCode = 400;
                            goto Exception;
                        }
                    }
                }
            }
            FeatureInfoResponse featureInfoResponse = wmts1Service.GetFeatureInfo(serviceRecord.Path, getFeatureInfo);
            content = XmlHelper.XmlSerialize(featureInfoResponse, Encoding, null);
            goto Success;
Exception:
            content = XmlHelper.XmlSerialize(exception, Encoding, null);
Success:
            ContentResult result = new ContentResult()
            {
                StatusCode = statusCode,
                Content    = content
            };
            return(result);
        }
Ejemplo n.º 10
0
        private async Task <ActionResult> GetTile(string serviceName, GetTile getTile)
        {
            ActionResult    result     = null;
            ExceptionReport exception  = null;
            int             statusCode = 200;

            #region Validate parameters
            if (string.IsNullOrWhiteSpace(serviceName))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "serviceName", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string serviceType = getTile.service;
            if (string.IsNullOrWhiteSpace(serviceType))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "service", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            if (serviceType.ToLower() != "wmts")
            {
                exception  = ExceptionReportHelper.GetExceptionReport("InvalidParameterValue", "version", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string version = getTile.version;
            if (string.IsNullOrWhiteSpace(version))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "version", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            if (version != "1.0.0")
            {
                exception  = ExceptionReportHelper.GetExceptionReport("InvalidParameterValue", "version", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string layerName = getTile.Layer;
            if (string.IsNullOrWhiteSpace(layerName))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "layer", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string style = getTile.Style;
            if (string.IsNullOrWhiteSpace(style))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "style", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string format = getTile.Format;
            if (string.IsNullOrWhiteSpace(format))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "format", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string tileMatrixSet = getTile.TileMatrixSet;
            if (string.IsNullOrWhiteSpace(tileMatrixSet))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "tileMatrixSet", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            string tileMatrix = getTile.TileMatrix;
            if (string.IsNullOrWhiteSpace(tileMatrix))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("MissingParameterValue", "tileMatrix", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            ServiceRecord serviceRecord = await GetServiceRecord(serviceName, version);

            if (serviceRecord == null)
            {
                exception  = ExceptionReportHelper.GetExceptionReport("InvalidParameterValue", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            if (!System.IO.File.Exists(serviceRecord.Path))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                statusCode = 500;
                goto Exception;
            }
            LayerRecord layerRecord = await GetLayerRecord(serviceRecord, layerName);

            if (layerRecord == null)
            {
                exception  = ExceptionReportHelper.GetExceptionReport("InvalidParameterValue", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            #endregion
            GetCapabilities getCapabilities = new GetCapabilities(version);
            IWmtsService    wmts1Service    = GetWmts1Service(version);
            Capabilities    capabilities    = wmts1Service.GetCapabilities(serviceRecord.Path, getCapabilities);
            if (capabilities == null)
            {
                exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                statusCode = 500;
                goto Exception;
            }
            LayerType layerType = capabilities.GetLayerType(layerRecord.Name);
            if (layerType == null)
            {
                exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                statusCode = 500;
                goto Exception;
            }
            if (!layerType.Format.Contains(format))
            {
                exception  = ExceptionReportHelper.GetExceptionReport("InvalidParameterValue", "format", exceptionText: "Bad request");
                statusCode = 400;
                goto Exception;
            }
            if (layerType.TileMatrixSetLink == null || layerType.TileMatrixSetLink.Length == 0)
            {
                exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                statusCode = 500;
                goto Exception;
            }
            string layerTileMatrixSetStr = layerType.TileMatrixSetLink[0].TileMatrixSet;
            if (layerTileMatrixSetStr != null)
            {
                TileMatrixSet layerTileMatrixSet = capabilities.Contents.TileMatrixSet?.FirstOrDefault(x => x.Identifier?.Value == layerTileMatrixSetStr);
                if (layerTileMatrixSet != null)
                {
                    TileMatrix layerTileMatrix = layerTileMatrixSet.TileMatrix?.FirstOrDefault(x => x.Identifier.Value == getTile.TileMatrix);
                    if (layerTileMatrix != null)
                    {
                        bool ret = layerTileMatrix.TopLeftCorner.ToPosition(out double left, out double top);
                        if (!ret)
                        {
                            exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                            statusCode = 500;
                            goto Exception;
                        }
                        BoundingBoxType boundingBoxType = layerType.BoundingBox?.Length > 0 ? layerType.BoundingBox[0] : layerType.WGS84BoundingBox?.Length > 0 ? layerType.WGS84BoundingBox[0] : null;
                        if (boundingBoxType == null)
                        {
                            exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                            statusCode = 500;
                            goto Exception;
                        }
                        bool ret0 = boundingBoxType.LowerCorner.ToPosition(out double xMin, out double yMin);
                        bool ret1 = boundingBoxType.UpperCorner.ToPosition(out double xMax, out double yMax);
                        if (!ret0 || !ret1)
                        {
                            exception  = ExceptionReportHelper.GetExceptionReport("NoApplicableCode", exceptionText: "Internal server error");
                            statusCode = 500;
                            goto Exception;
                        }
                        bool isDegree = layerTileMatrixSet.GetIsDegreeByLocalDb();
                        layerTileMatrix.GetTileIndex(isDegree, xMin, yMax, out int startCol, out int startRow);
                        int matrixWidth  = Convert.ToInt32(layerTileMatrix.MatrixWidth);
                        int matrixHeight = Convert.ToInt32(layerTileMatrix.MatrixHeight);
                        if (getTile.TileCol < startCol || getTile.TileCol >= startCol + matrixWidth || getTile.TileRow < startRow || getTile.TileRow >= startRow + matrixHeight)
                        {
                            exception  = ExceptionReportHelper.GetExceptionReport("TileOutOfRange", exceptionText: "Bad request");
                            statusCode = 400;
                            goto Exception;
                        }
                    }
                }
            }
            try
            {
                byte[] tileBuffer = wmts1Service.GetTile(capabilities, layerRecord.Path, getTile);
                result = new FileContentResult(tileBuffer, getTile.Format);
            }
            catch (Exception e)
            {
                Debug.WriteLine($"获取瓦片{getTile.TileMatrix}_{getTile.TileCol}_{getTile.TileRow}失败:{e.Message}");
            }
            goto Success;
Exception:
            string content = XmlHelper.XmlSerialize(exception, Encoding, null);
            result         = new ContentResult()
            {
                StatusCode = statusCode,
                Content    = content
            };
Success:
            return(result);
        }
Ejemplo n.º 11
0
        public List <LayerRecord> Read(Stream stream, LayersInformation layersInformation, FileVersion fileVersion)
        {
            var list = new List <LayerRecord>();

            var reader = new BigEndianBinaryReader(stream);

            stream.Position = layersInformation.Offset;

            for (int i = 0; i < layersInformation.LayerCount; i++)
            {
                var layerRecord = new LayerRecord();

                layerRecord.RectangleTop    = reader.ReadInt32();
                layerRecord.RectangleLeft   = reader.ReadInt32();
                layerRecord.RectangleBottom = reader.ReadInt32();
                layerRecord.RectangleRight  = reader.ReadInt32();

                layerRecord.ChannelCount = reader.ReadInt16();
                layerRecord.Channels     = new ChannelInformation[layerRecord.ChannelCount];
                for (int j = 0; j < layerRecord.ChannelCount; j++)
                {
                    layerRecord.Channels[j]        = new ChannelInformation();
                    layerRecord.Channels[j].Id     = reader.ReadInt16();
                    layerRecord.Channels[j].Length = fileVersion == FileVersion.Psd ? reader.ReadInt32() : reader.ReadInt64();
                }

                layerRecord.BlendModeSignature = new string(reader.ReadChars(4));
                layerRecord.BlendModeKey       = new string(reader.ReadChars(4));
                layerRecord.Opacity            = reader.ReadByte();
                layerRecord.Clipping           = (Clipping)reader.ReadByte();

                var flags = reader.ReadByte();
                layerRecord.IsTransparencyProtected = flags.GetBit(0);
                layerRecord.IsVisible  = flags.GetBit(1);
                layerRecord.IsObsolete = flags.GetBit(2);
                if (flags.GetBit(3))
                {
                    layerRecord.IsPixelIrrelevantToAppearance = flags.GetBit(4);
                }

                reader.ReadByte(); // filler

                layerRecord.Length = reader.ReadInt32();
                layerRecord.Offset = stream.Position;

                // TODO: Layer mask / adjustment layer data
                var maskLength = reader.ReadInt32();
                stream.Position += maskLength;

                // TODO: Layer blending ranges data
                var blendingLength = reader.ReadInt32();
                stream.Position += blendingLength;

                layerRecord.Name = reader.ReadPascalString();

                reader.ReadByte(); //???

                layerRecord.AdditionalLayerInformation        = new AdditionalLayerInformation();
                layerRecord.AdditionalLayerInformation.Offset = stream.Position;
                layerRecord.AdditionalLayerInformation.Length = (layerRecord.Offset + layerRecord.Length) - layerRecord.AdditionalLayerInformation.Offset;

                stream.Position = layerRecord.Offset + layerRecord.Length;

                list.Add(layerRecord);
            }

            return(list);
        }
Ejemplo n.º 12
0
 public LayerModel(VectorLayer vectorLayer, LabelLayer labelLayer, LayerRecord layerRecord)
 {
     this.vectorLayer = vectorLayer;
     this.labelLayer  = labelLayer;
     this.layerRecord = layerRecord;
 }