Difference between revisions of "Collectors"

From Wiki
Jump to navigation Jump to search
(Created a page on this complicated feature. It will need to be enriched with experience.)
 
m
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
< [[Layout]] | [[Columns]] | [[Overlays]] | [[Logos]] | [[Layers]] >
 
 
 
Collectors are an alternative to overlays that can be used to build-up composite objects.
 
Collectors are an alternative to overlays that can be used to build-up composite objects.
[[Layers]] on the other hand, are used to define whole pages.
+
[[Layers]], on the other hand, are used to define whole pages.
See the [http://www.pragma-ade.com/general/manuals/details.pdf details] manual for further explanations.
+
See the [[manual:details.pdf| details]] manual for further explanations.
  
 
==Example==
 
==Example==
Line 9: Line 7:
 
Adding labels to a figure.
 
Adding labels to a figure.
  
 +
<table><tr valign="top"><td>
 
<texcode>
 
<texcode>
 
\starttext                                                                             
 
\starttext                                                                             
  
 
\definecollector[example]
 
\definecollector[example]
\setcollector [example] { \externalfigure[cow][width=4cm,frame=on] }
+
\setcollector [example] {\externalfigure[cow][width=4cm,frame=on]}
\setcollector [example] [corner={right,bottom},location={right,bottom}]
+
\setcollector [example] [corner={right,bottom},location={left,top}]
 
         {\framed{1}}
 
         {\framed{1}}
\setcollector [example] [corner={right,top},location={right,top}]
+
\setcollector [example] [corner={right,top},location={left,bottom}]
 
         {\framed{2}}
 
         {\framed{2}}
\setcollector [example] [corner={left,top},location={left,top}]
+
\setcollector [example] [corner={left,top},location={right,bottom}]
 
         {\framed{3}}
 
         {\framed{3}}
\setcollector [example] [corner={left,bottom},location={left,bottom}]
+
\setcollector [example] [corner={left,bottom},location={right,top}]
 
         {\framed{4}}
 
         {\framed{4}}
  
\startTEXpage
+
\composedcollector{example}
        \composedcollector{example}
 
\stopTEXpage
 
  
 
\stoptext
 
\stoptext
 
</texcode>
 
</texcode>
 
+
</td><td>
 
<context>
 
<context>
 +
\setupexternalfigures[location={local,default}]
 
\definecollector[example]
 
\definecollector[example]
\setcollector [example] { \externalfigure[cow][width=4cm,frame=on] }
+
\setcollector [example] {\externalfigure[cow][width=4cm,frame=on]}
\setcollector [example] [corner={right,bottom},location={right,bottom}]
+
\setcollector [example] [corner={right,bottom},location={left,top}]
 
         {\framed{1}}
 
         {\framed{1}}
\setcollector [example] [corner={right,top},location={right,top}]
+
\setcollector [example] [corner={right,top},location={left,bottom}]
 
         {\framed{2}}
 
         {\framed{2}}
\setcollector [example] [corner={left,top},location={left,top}]
+
\setcollector [example] [corner={left,top},location={right,bottom}]
 
         {\framed{3}}
 
         {\framed{3}}
\setcollector [example] [corner={left,bottom},location={left,bottom}]
+
\setcollector [example] [corner={left,bottom},location={right,top}]
 
         {\framed{4}}
 
         {\framed{4}}
  
 
\composedcollector{example}
 
\composedcollector{example}
 
</context>
 
</context>
 +
</td></tr></table>
 +
 +
There is no confusion if the added text is placed within the first object. However,
 +
 +
<table><tr valign="top"><td>
 +
<texcode>
 +
\starttext                                                                           
 +
 +
\definecollector[example2]
 +
\setcollector [example2] {\externalfigure[cow][width=4cm,frame=on]}
 +
\setcollector [example2] [corner={right,bottom},location={right,bottom}]
 +
        {\framed{1}}
 +
\setcollector [example2] [corner={right,top},location={right,top}]
 +
        {\framed{2}}
 +
\setcollector [example2] [corner={left,top},location={left,top}]
 +
        {\framed{3}}
 +
\setcollector [example2] [corner={left,bottom},location={left,bottom}]
 +
        {\framed{4}}
 +
 +
\composedcollector{example2}
 +
 +
\stoptext
 +
</texcode>
 +
</td><td>
 +
<context>
 +
\setupexternalfigures[location={local,default}]
 +
\definecollector[example2]
 +
\setcollector [example2] {\externalfigure[cow][width=4cm,frame=on]}
 +
\setcollector [example2] [corner={right,bottom},location={right,bottom}]
 +
        {\framed{1}}
 +
\setcollector [example2] [corner={right,top},location={right,top}]
 +
        {\framed{2}}
 +
\setcollector [example2] [corner={left,top},location={left,top}]
 +
        {\framed{3}}
 +
\setcollector [example2] [corner={left,bottom},location={left,bottom}]
 +
        {\framed{4}}
 +
 +
\composedcollector{example2}
 +
</context>
 +
</td></tr></table>
  
 
Notice that the size of the collected object grows as text is added.
 
Notice that the size of the collected object grows as text is added.
 
As a consequence, the positions of the corners get redefined as the bounding box grows.
 
As a consequence, the positions of the corners get redefined as the bounding box grows.
 +
 +
{{todo|We need more documentation and examples for this complicated subject.}}
 +
 +
[[Category:Graphics]] [[Category:Layers]]

Revision as of 22:08, 6 June 2020

Collectors are an alternative to overlays that can be used to build-up composite objects. Layers, on the other hand, are used to define whole pages. See the details manual for further explanations.

Example

Adding labels to a figure.

\starttext                                                                             

\definecollector[example]
\setcollector [example] {\externalfigure[cow][width=4cm,frame=on]}
\setcollector [example] [corner={right,bottom},location={left,top}]
        {\framed{1}}
\setcollector [example] [corner={right,top},location={left,bottom}]
        {\framed{2}}
\setcollector [example] [corner={left,top},location={right,bottom}]
        {\framed{3}}
\setcollector [example] [corner={left,bottom},location={right,top}]
        {\framed{4}}

\composedcollector{example}

\stoptext

There is no confusion if the added text is placed within the first object. However,

\starttext                                                                             

\definecollector[example2]
\setcollector [example2] {\externalfigure[cow][width=4cm,frame=on]}
\setcollector [example2] [corner={right,bottom},location={right,bottom}]
        {\framed{1}}
\setcollector [example2] [corner={right,top},location={right,top}]
        {\framed{2}}
\setcollector [example2] [corner={left,top},location={left,top}]
        {\framed{3}}
\setcollector [example2] [corner={left,bottom},location={left,bottom}]
        {\framed{4}}

\composedcollector{example2}

\stoptext

Notice that the size of the collected object grows as text is added. As a consequence, the positions of the corners get redefined as the bounding box grows.


TODO: We need more documentation and examples for this complicated subject. (See: To-Do List)