| 718 | ==== Filtering on Features with Annotation Properties ==== |
| 719 | |
| 720 | TBD… |
| 721 | |
| 722 | Q: Can you filter on Annotation values? Join? Computed Values? Do we need to define a textual representation of an Annotation property and subsequently update the FDO filter parser to recognize the new constructs? |
| 723 | |
| 724 | ==== Accessing Annotation Text Element Stylization ==== |
| 725 | |
| 726 | Each Annotation object will contain references to its Text Elements exposed through an associated collection of !FdoAnnotationTextElement objects. Text Attributes will be supported for individual Text Entities using XML descriptive text that will be supported through a set of XML serializable objects that allow all of the attributes to be programmatically accessed. |
| 727 | |
| 728 | As mandated by the OGC Simple Feature Access Specification, each Text Element associated to an Annotation will allow attributes to be specified for Style and Layout. Style attributes will include properties for Font, Fill, Stroke and Decoration. Layout attributes will include properties for Alignment, Justification and Spacing. In the FDO API, these properties will be exposed on two new classes !FdoTextElementStyle and !FdoTextElementLayout. |
| 729 | |
| 730 | |
| 731 | {{{ |
| 732 | class FdoTextElementStyle |
| 733 | { |
| 734 | public: |
| 735 | FdoString* FontFamily; |
| 736 | double FontSize; |
| 737 | FdoFontWeightType FontWeight; |
| 738 | FdoFontStyleType FontStyle; |
| 739 | FdoTextDecorationType TextDecoration; |
| 740 | FdoString* FillColor; |
| 741 | double FillOpacity; |
| 742 | FdoString* StrokeColor; |
| 743 | double StrokeWidth; |
| 744 | double StrokOpacity; |
| 745 | }; |
| 746 | }}} |
| 747 | |
| 748 | {{{ |
| 749 | class FdoTextElementLayout |
| 750 | { |
| 751 | public: |
| 752 | FdoHorizontalAlignmentType HorizontalAlignment; |
| 753 | FdoVerticalAlignmentType VerticalAlignment; |
| 754 | FdoMultilineJustificationType MultilineJustification; |
| 755 | double MultilineSpacing; |
| 756 | }; |
| 757 | }}} |
| 758 | |
| 759 | These two sets of properties shall be exposed through another new Interface !FdoTextElemnetAttributes. This interface will allow both sets of properties to be grouped together yet still allow each group to be accessed separately. Instances of !TextElementAttributes will be associated to the FDO Annotation as a whole through the "!TextDefaultAttributes" property, and to each FDO Text Element through its "!TextAttributes" property. |
| 760 | |
| 761 | {{{ |
| 762 | class FdoTextElementAttributes |
| 763 | { |
| 764 | public: |
| 765 | FdoTextElementStyle* TextStyle; |
| 766 | FdoTextElementLayout* TextLayout; |
| 767 | }; |
| 768 | }}} |
| 769 | |
| 770 | ===== Processing Text Element Attributes ===== |
| 771 | |
| 772 | Using the select example preciously documented to query Annotations, we can continue to flush out the on and show how the de-serialized XML string elements can be accessed using the classes described above. |
| 773 | |
| 774 | {{{ |
| 775 | // Since OGC allows text elements to inherit their style |
| 776 | // from previously defined elements, we will need to save a |
| 777 | // "parent" style information as we work down the element array |
| 778 | FdoTextElementStyleP parentTextStyle; |
| 779 | FdoTextElementLayoutP parentTextLayout; |
| 780 | |
| 781 | // Each Annotation has 0...n Text Elements that are the actual text values |
| 782 | FdoAnnotationTextElementCollectionP textElements = annotation->GetTextElements(); |
| 783 | for (FdoInt32 i=0; i<textElements->GetCount(); i++) |
| 784 | { |
| 785 | // Get the n’th Text Element and read its style values |
| 786 | FdoAnnotationTextElementP textElement = textElements->GetItem(i); |
| 787 | |
| 788 | // As seen above, the XML text will need to be parsed into its API clases |
| 789 | FdoStringP textAttributes = textElement->GetTextAttributesAsXml(); |
| 790 | |
| 791 | // Convert the FdoString to a char array and stream it into memory |
| 792 | const char* charArrayA = (const char*)textAttributes; |
| 793 | FdoIoMemoryStreamP streamA = FdoIoMemoryStream::Create(); |
| 794 | streamA->Write( (FdoByte*) charArrayA, strlen(charArrayA) ); |
| 795 | streamA->Reset(); |
| 796 | |
| 797 | // Create the extended style object (initially empty) and read the style |
| 798 | // attributes into it from the XML stream. |
| 799 | FdoTextElementAttributesP attributes = FdoTextElementAttributes::Create(); |
| 800 | attributes->ReadXml(streamA); |
| 801 | |
| 802 | // Extract the text style info. If defined for this element process and display it. |
| 803 | // NOTE: The OGC specification allow for elements higher in the display |
| 804 | // list to dictate style if the element lower in the array has no style |
| 805 | // information specified. Therefore, save the parent and use it later in the |
| 806 | // array iteration if needed. This applies for the next 3 types as well |
| 807 | FdoTextElementStyleP textStyle = attributes->GetTextStyle(); |
| 808 | if (textStyle) |
| 809 | { |
| 810 | ProcessTextStyle(textStyle); |
| 811 | parentTextStyle = textStyle; |
| 812 | } |
| 813 | else if (parentTextStyle) |
| 814 | ProcessTextStyle(parentTextStyle); |
| 815 | |
| 816 | // Extract the layout style. If defined for this element process it for display |
| 817 | FdoTextElementLayoutP textLayout = attributes->GetTextLayout(); |
| 818 | if (textLayout) |
| 819 | { |
| 820 | ProcessLayoutStyle(textLayout); |
| 821 | parentTextLayout = textLayout; |
| 822 | } |
| 823 | else if (parentTextLayout) |
| 824 | ProcessLayoutStyle(parentTextLayout); |
| 825 | } |
| 826 | }}} |
| 827 | |