예제 #1
0
        protected override void AddValuePairs(List <DxfCodePair> pairs, DxfAcadVersion version, bool outputHandles)
        {
            base.AddValuePairs(pairs, version, outputHandles);
            pairs.Add(new DxfCodePair(100, "AcDbSunStudy"));
            pairs.Add(new DxfCodePair(90, (this.Version)));
            pairs.Add(new DxfCodePair(1, (this.SunSetupName)));
            pairs.Add(new DxfCodePair(2, (this.Description)));
            pairs.Add(new DxfCodePair(70, (this.OutputType)));
            pairs.Add(new DxfCodePair(3, (this.SheetSetName)));
            pairs.Add(new DxfCodePair(290, (this.UseSubset)));
            pairs.Add(new DxfCodePair(4, (this.SheetSubsetName)));
            pairs.Add(new DxfCodePair(291, (this.SelectDatesFromCalendar)));
            pairs.Add(new DxfCodePair(91, Dates.Count));
            foreach (var item in Dates)
            {
                pairs.Add(new DxfCodePair(90, (int)DxfCommonConverters.DateDouble(item)));
                pairs.Add(new DxfCodePair(90, DxfCommonConverters.DateDouble(item)));
            }

            pairs.Add(new DxfCodePair(292, (this.SelectRangeOfDates)));
            if (SelectRangeOfDates)
            {
                pairs.Add(new DxfCodePair(93, (this.StartTime_SecondsPastMidnight)));
            }

            if (SelectRangeOfDates)
            {
                pairs.Add(new DxfCodePair(94, (this.EndTime_SecondsPastMidnight)));
            }

            if (SelectRangeOfDates)
            {
                pairs.Add(new DxfCodePair(95, (this.IntervalInSeconds)));
            }

            pairs.Add(new DxfCodePair(73, (short)Hours.Count));
            pairs.AddRange(this.Hours.Select(p => new DxfCodePair(290, (short)(p))));
            pairs.Add(new DxfCodePair(340, DxfCommonConverters.UIntHandle(this.PageSetupWizardPointer.Handle)));
            pairs.Add(new DxfCodePair(341, DxfCommonConverters.UIntHandle(this.ViewPointer.Handle)));
            pairs.Add(new DxfCodePair(342, DxfCommonConverters.UIntHandle(this.VisualStylePointer.Handle)));
            pairs.Add(new DxfCodePair(74, (this.ShadePlotType)));
            pairs.Add(new DxfCodePair(75, (short)(this.ViewportsPerPage)));
            pairs.Add(new DxfCodePair(76, (short)(this.ViewportDistributionRowCount)));
            pairs.Add(new DxfCodePair(77, (short)(this.ViewportDistributionColumnCount)));
            pairs.Add(new DxfCodePair(40, (this.Spacing)));
            pairs.Add(new DxfCodePair(293, (this.LockViewports)));
            pairs.Add(new DxfCodePair(294, (this.LabelViewports)));
            pairs.Add(new DxfCodePair(343, DxfCommonConverters.UIntHandle(this.TextStylePointer.Handle)));
        }
예제 #2
0
 protected static double DateDouble(DateTime date)
 {
     return(DxfCommonConverters.DateDouble(date));
 }
예제 #3
0
        internal override DxfObject PopulateFromBuffer(DxfCodePairBufferReader buffer)
        {
            bool seenVersion  = false;
            bool readingHours = false;
            int  julianDay    = -1;

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                while (this.TrySetExtensionData(pair, buffer))
                {
                    pair = buffer.Peek();
                }

                switch (pair.Code)
                {
                case 1:
                    this.SunSetupName = (pair.StringValue);
                    break;

                case 2:
                    this.Description = (pair.StringValue);
                    break;

                case 3:
                    this.SheetSetName = (pair.StringValue);
                    break;

                case 4:
                    this.SheetSubsetName = (pair.StringValue);
                    break;

                case 40:
                    this.Spacing = (pair.DoubleValue);
                    break;

                case 70:
                    this.OutputType = (pair.ShortValue);
                    break;

                case 73:
                    readingHours = true;
                    break;

                case 74:
                    this.ShadePlotType = (pair.ShortValue);
                    break;

                case 75:
                    this.ViewportsPerPage = (pair.ShortValue);
                    break;

                case 76:
                    this.ViewportDistributionRowCount = (pair.ShortValue);
                    break;

                case 77:
                    this.ViewportDistributionColumnCount = (pair.ShortValue);
                    break;

                case 90:
                    if (!seenVersion)
                    {
                        this.Version = pair.IntegerValue;
                        seenVersion  = true;
                    }
                    else
                    {
                        // after the version, 90 pairs come in julianDay/secondsPastMidnight duals
                        if (julianDay == -1)
                        {
                            julianDay = pair.IntegerValue;
                        }
                        else
                        {
                            var date = DxfCommonConverters.DateDouble(julianDay);
                            date = date.AddSeconds(pair.IntegerValue);
                            this.Dates.Add(date);
                            julianDay = -1;
                        }
                    }
                    break;

                case 93:
                    this.StartTime_SecondsPastMidnight = (pair.IntegerValue);
                    break;

                case 94:
                    this.EndTime_SecondsPastMidnight = (pair.IntegerValue);
                    break;

                case 95:
                    this.IntervalInSeconds = (pair.IntegerValue);
                    break;

                case 290:
                    if (!readingHours)
                    {
                        this.UseSubset = (pair.BoolValue);
                        readingHours   = true;
                    }
                    else
                    {
                        this.Hours.Add(pair.ShortValue);
                    }
                    break;

                case 291:
                    this.SelectDatesFromCalendar = (pair.BoolValue);
                    break;

                case 292:
                    this.SelectRangeOfDates = (pair.BoolValue);
                    break;

                case 293:
                    this.LockViewports = (pair.BoolValue);
                    break;

                case 294:
                    this.LabelViewports = (pair.BoolValue);
                    break;

                case 340:
                    this.PageSetupWizardPointer.Handle = UIntHandle(pair.StringValue);
                    break;

                case 341:
                    this.ViewPointer.Handle = UIntHandle(pair.StringValue);
                    break;

                case 342:
                    this.VisualStylePointer.Handle = UIntHandle(pair.StringValue);
                    break;

                case 343:
                    this.TextStylePointer.Handle = UIntHandle(pair.StringValue);
                    break;

                default:
                    if (!base.TrySetPair(pair))
                    {
                        ExcessCodePairs.Add(pair);
                    }
                    break;
                }

                buffer.Advance();
            }

            return(PostParse());
        }