public void Write(ParcelSummary summary, IMessageWriter writer)
        {
            var message = $"Found {summary.Count} parcels.";

            message += $"\nCombined area: {summary.Area:N2}";

            writer.WriteMessage(message);
        }
Пример #2
0
        public void Write(ParcelSummary summary, IMessageWriter writer)
        {
            var message = $@"<!DOCTYPE HTML>
<html>
    <head>
        <title>Parcel Summary</title>
    </head>
    <body>
        <h1>Parcel Summary for {Active.Document.Name}</h1>
        <ul>
            <li>Found {summary.Count} parcels.</li>
            <li>Combined area: {summary.Area:N2}</li>
        </ul>
    </body>
</html>";

            writer.WriteMessage(message);
        }
        public ParcelSummary Count()
        {
            var summary = new ParcelSummary();
            PromptSelectionResult result = SelectParcels();

            if (result.Status == PromptStatus.OK)
            {
                Active.UsingTransaction(tr =>
                {
                    foreach (var objectId in result.Value.GetObjectIds())
                    {
                        var polyline = (Polyline)tr.GetObject(objectId, OpenMode.ForRead);
                        if (polyline.Closed)
                        {
                            summary.Count++;
                            summary.Area += polyline.Area;
                        }
                    }
                });
            }

            return(summary);
        }