Ejemplo n.º 1
0
        private PFD MapField(Field field, Dictionary <int, string> keyToIsoId, int fieldIndex, Catalog setupCatalog)
        {
            var isoField = new PFD
            {
                C = field.Description,
                D = (ulong)Math.Round(field.Area.Value.Value, 0)
            };

            isoField.A = isoField.GetIsoId(fieldIndex);
            if (field.FarmId != null)
            {
                isoField.F = keyToIsoId[field.FarmId.Value];
                var farm = setupCatalog.Farms.First(f => f.Id.ReferenceId == field.FarmId.Value);
                if (farm.GrowerId != null)
                {
                    isoField.E = keyToIsoId[farm.GrowerId.Value];
                }
            }
            if (field.ActiveBoundaryId != null)
            {
                var boundary = setupCatalog.FieldBoundaries.Single(b => b.Id.ReferenceId == field.ActiveBoundaryId.Value);
                isoField.Items = new IWriter[] { _boundaryMapper.Map(boundary.SpatialData, BoundaryType.Field, boundary.Description) };
            }

            keyToIsoId.Add(field.Id.ReferenceId, isoField.A);
            return(isoField);
        }
Ejemplo n.º 2
0
        private PFD Map(CropZone cropZone, Dictionary <int, string> keyToIsoId, int cropZoneIndex, Catalog setupCatalog)
        {
            var pfd = new PFD
            {
                C = cropZone.Description,
                D = (ulong)Math.Round(cropZone.Area.Value.Value, 0)
            };

            pfd.A = pfd.GetIsoId(cropZoneIndex);
            if (cropZone.CropId != null)
            {
                pfd.G = keyToIsoId[cropZone.CropId.Value];
            }
            pfd.I = keyToIsoId[cropZone.FieldId];
            var field = setupCatalog.Fields.First(f => f.Id.ReferenceId == cropZone.FieldId);

            if (field.FarmId != null)
            {
                pfd.F = keyToIsoId[field.FarmId.Value];
                var farm = setupCatalog.Farms.First(f => f.Id.ReferenceId == field.FarmId.Value);
                if (farm.GrowerId != null)
                {
                    pfd.E = keyToIsoId[farm.GrowerId.Value];
                }
            }
            if (cropZone.BoundingRegion != null)
            {
                pfd.Items = new IWriter[] { _boundaryMapper.Map(cropZone.BoundingRegion, BoundaryType.CropZone, cropZone.Description) };
            }

            keyToIsoId.Add(cropZone.Id.ReferenceId, pfd.A);
            return(pfd);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes the structure.
        /// </summary>
        /// <param name="flags">A <see cref="PFD"/>-bitmask specifying pixel format flags.</param>
        public PixelFormatDescriptor(PFD flags = PFD.Default)
        {
            nSize      = 0;
            nVersion   = 1;
            dwFlags    = flags;
            iPixelType = PFD_TYPE.RGBA;
            cColorBits = 32;
            cRedBits   = cRedShift = cGreenBits = cGreenShift = cBlueBits = cBlueShift = cAlphaBits = cAlphaShift = 0;
#pragma warning disable 618 // Disable deprecated messages
            cAccumBits = cAccumRedBits = cAccumGreenBits = cAccumBlueBits = cAccumAlphaBits = 0;
#pragma warning restore 618
            cDepthBits   = 24;
            cStencilBits = 8;
            cAuxBuffers  = iLayerType = bReserved = 0;
            dwLayerMask  = dwVisibleMask = dwDamageMask = 0;

            nSize = (ushort)Marshal.SizeOf(this);
        }
Ejemplo n.º 4
0
 public void Setup()
 {
     _pfd        = new PFD();
     _output     = new StringBuilder();
     _xmlBuilder = XmlWriter.Create(_output);
 }
Ejemplo n.º 5
0
		/// <summary>
		/// Initializes the structure.
		/// </summary>
		/// <param name="flags">A <see cref="PFD"/>-bitmask specifying pixel format flags.</param>
		public PixelFormatDescriptor(PFD flags=PFD.Default)
		{
			nSize=0;
			nVersion=1;
			dwFlags=flags;
			iPixelType=PFD_TYPE.RGBA;
			cColorBits=32;
			cRedBits=cRedShift=cGreenBits=cGreenShift=cBlueBits=cBlueShift=cAlphaBits=cAlphaShift=0;
#pragma warning disable 618 // Disable deprecated messages
			cAccumBits=cAccumRedBits=cAccumGreenBits=cAccumBlueBits=cAccumAlphaBits=0;
#pragma warning restore 618
			cDepthBits=24;
			cStencilBits=8;
			cAuxBuffers=iLayerType=bReserved=0;
			dwLayerMask=dwVisibleMask=dwDamageMask=0;

			nSize=(ushort)Marshal.SizeOf(this);
		}