[LON-CAPA-dev] RFC: XML for <imageresponse> rewrite

Guy Albertelli II lon-capa-dev@mail.lon-capa.org
Tue, 11 Oct 2005 18:01:27 -0400 (EDT)


Hey,

> > It seems a wrapper tag of <answer> is at least needed, and some markup
> > about what style of answer is required should be added (<area>,
> > <vector>, <line>)
> 
> > So the simplfied example template of:
> >
> > <imageresponse max="1">
> >   <foilgroup>
> >     <foil name="foil1">
> >       <image>/res/adm/includes/templates/man1.jpg</image>
> >       <text>Click on an eye</text>
> >       <rectangle>(127,139)-(186,178)</rectangle>
> >       <rectangle>(242,139)-(306,183)</rectangle>
> >     </foil>
> > </imageresponse>
> >
> >
> > Should become:
> >
> > <imageresponse max="1">
> >   <foilgroup>
> >     <foil name="foil1">
> >       <image>/res/adm/includes/templates/man1.jpg</image>
> >       <text>Click on an eye</text>
> >       <answer>
> >         <area>
> >           <rectangle>(127,139)-(186,178)</rectangle>
> >           <rectangle>(242,139)-(306,183)</rectangle>
> >         </area>
> >       </answer>
> >     </foil>
> > </imageresponse>
> 
> 
> - so, this would not be compatible with old content?

We could easily support existing content, no need to annoy people.


> 
> > Thus specifying an answer of 1 click is needed (1 <area> exists), with
> > multiple locations of correctness (the 2 <rectangle>s)
> >
> >
> > Multiple clicks can be required by (2 <areas>, 1 of which has multiple
> > correct spots, 1 of which has only 1 correct spot):
> >
> > <imageresponse max="1">
> >   <foilgroup>
> >     <foil>
> >       <image>/res/adm/includes/templates/man1.jpg</image>
> >       <text>Click on an eye and on the mouth</text>
> >       <answer>
> >         <area>
> >           <rectangle>(127,139)-(186,178)</rectangle>
> >           <rectangle>(242,139)-(306,183)</rectangle>
> >         </area>
> >         <area>
> >           <rectangle>(142,226)-(294,293)</rectangle>
> >        </area>
> >       </answer>
> >     </foil>
> >   </foilgroup>
> > </imageresponse>
> >
> > We could also require the order of the clicks to matter (they must
> > make the first <area> 'click 1' and the second <area> 'click 2':
> >
> > <answer ordered="yes">
> >   <area>
> >     <circle>(250,250,15)</circle>
> >   </area>
> >   <area>
> >     <circle>(500,500,15)</circle>
> >   </area>
> > </answer>
> 
> 
> I like this a lot - but it needs to accept leaving out <answer> if  
> there is only one because of existing content.

if answer exists -> new mechanism, if answer doesn't exist -> old
mechanism.


> I assume that all of these can be variable, e.g.,
> 
> <answer ordered="yes">
>    <area>
>      <circle>($x,$y,$r)</circle>
>    </area>
>    <area>
>      <circle>(@circle)</circle>
>    </area>
> </answer>
> 
> - where @circle has all three.

Yes.

> >
> > Onto vector answers, this example requires 3 vectors and 1 line as a
> > correct answer,
> >
> > - vector 1 must origniate inside of the <from> <circle> and terminate
> > in the <to> circle
> >
> > - vector 2 must originate in the <from> cirlce and terminate inside of
> > one of the <to> <circle>s
> >
> > - line 1 must connect the <from> and <to> circles, but the order
> > doesn't matter
> 
> 
> Okay, I don't understand why this is tied to other objects. I would  
> suggest

Some people don't want to draw a force diagram, they want an arrow
going from location 1 to location 2.

(For instance concept mapping.)

And as will already have areal specifiers (for click support anyway)
why not use this?



> 
> <vector>
> <xlength unit="pixels">40</xlength>
> <ylength unit="pixels">80</ylength>
> </vector>
> or
> 
> <vector>
> <length unit="pixels">50</length>
> <angle unit="radians">.34</angle>
> </vector>
> 
> for vectors in cartesian or polar coordinates.

These are proposed below as a second style of <vector>,
i.e. positionless vectors.


> You might then add an origin if you want to tie to a certain location:
> 
> <vector>
> <xinitial unit="pixels">30</xinitial>
> <yinitialunit="pixels">60</yinitial>
> <xlength unit="pixels">40</xlength>
> <ylength unit="pixels">80</ylength>
> </vector>


How do you specify the tolerenceing on this? 

As a freaking huge mess and then you still can't easily do
circles/rectangles/polygons areas of correctness.

Really we do need to support connecting things together and I think
you would be hard pressed to find:

<vector>
  <xinitial unit="pixels">
    30
    <responseparam name="tolerance" type="tolerance" default="12" />
  </xinitial>
  <yinitial unit="pixels">
    60
    <responseparam name="tolerance" type="tolerance" default="12" />
  </yinitial>
  <xlength unit="pixels">
    40
    <responseparam name="tolerance" type="tolerance" default="12" />
  </xlength>
  <ylength unit="pixels">
    80
    <responseparam name="tolerance" type="tolerance" default="12" />
  </ylength>
</vector>

better than:

<vector>
  <from><circle>(30,60,12)</circle></from>
  <to><circle>(70,140,12)</circle></to>
</vector>

evening ignoring the fact that I can't even convey the circular area
of correctness using the <xinitial> etc. concept.



> 
> <vector>
> <xinitial unit="pixels">30</xinitial>
> <yinitial unit="pixels">30</yinitial>
> <length unit="pixels">50</length>
> <angle unit="radians">.34</angle>
> </vector>
> 
> Finally, you could get the vector by giving its end point:
> 
> <vector>
> <xinitial unit="pixels">30</xinitial>
> <yinitial unit="pixels">60</yinitial>
> <xfinal unit="pixels">80</xfinal>
> <yfinal unit="pixels">90</yfinal>
> </vector>
> 
> 
> - as a physicist, I would actually like this less verbose XML-y, so I  
> can plug in arrays:
> 
> <vector>
> <initial unit="pixels">30,60</xinitial>
> <final unit="pixels">@final</final>
> </vector>
> 
> Or
> 
> <vector>
> <length unit="pixels">40,$height</length>
> </vector>
> 
> 
> 
> >   <vector type="locationless">
> >      <!-- radians also possible -->
> >      <angle unit="degrees" tolerance="3%">35</angle>
> >      <!-- other units % of image? If we go with the absolute
> >           measurement idea a unit of 'absolute' -->
> >      <length unit="pixel" tolerance="15">100</length>
> >   </vector>
> 
> 
> I don't like the tolerance being packaged like that. We should use  
> response parameters, just like with numerical.

I'm open minded about this, but considering this mean ending up with

tolerance for partid_responseid_objectid_attributeid 

with little likelyhood that anyone would be that interested in
changing this excpet for the author, it seems a little dubious.


> >
> > For simplying the amount typing, we could create a means to name
> > certain areas for easy reuse.
> >
> > <answer>
> >   <hotspots>
> >     <circle name="circle1">(250,250,15)</circle>
> >     <rectangle name="rectangle1">(100,100)-(250,250)</rectangle>
> >     <polygon name="poly1">....</polygon>
> >   </hotspots>
> >   <vector>
> >     <from><hotspot>circle1</hotspot></from>
> >     <to><circle>(100,101,2)</circle></to>
> >   </vector>
> >   <area>
> >     <hotspot>poly1</hotspot>
> >   </area>
> > </answer>
> 
> 
> I like, but again, I don't see the idea of tying this to objects.

> 
> How about named coordinates, which are internally treated like  
> cartesian vectors:
> 
> >
> >
> > I guess if I really want to go for the XML route it should be:
> > <circle>
> >   <x>250</x>
> >   <y>250</y>
> >   <radius>15</radius>
> > </circle>
> 
> 
> Hmmm ... I would like to plug in arrays.
> 
> - Gerd.
> _______________________________________________
> LON-CAPA-dev mailing list
> LON-CAPA-dev@mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev
> 

-- 
guy@albertelli.com   0-7-2-1-27,137