xIndex
defines the
x
coordinate of the slot.
yIndex
defines the
y
coordinate of the slot.
xSpan
defines the spanning over
x
.
ySpan
defines the spanning over
y
.
yIndex
is always equal to
0
and
ySpan
is always equal to
1.0
.
xIndex
and
yIndex
), while card carriers support slots referenced by a single index
(
xIndex
). The spanning attributes of IlpShelfItemPosition define by how much the
card spans over the neighboring slots: a value of
1.0
means no spanning at all; a value of
2.0
means that the next slot is fully occupied; a value of
1.5
means that the next slot is partially occupied (50%).
// Creates a shelf business object IltShelf shelf = new IltShelf(3, 60, 3, 60, 0); // Sets its view position to point (50, 50) shelf.setPosition(new IlpPoint(50, 50)); // Creates a card business object IltCard card = new IltCard((IltObjectState)null, "card"); // Sets its relative position to index x = 0, spanning over by 1.8 // and index y = 1, spanning over by 1.2. card.setPosition(new IlpShelfItemPosition(0, 1, 1.8f, 1.2f)); // Sets the relationship between card and shelf dataSource.setParent(card, shelf);
// Adds objects to the data source dataSource.addObject(shelf); dataSource.addOject(card);
<cplData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "ilog/cpl/schema/data.xsd"> <addObject id="shelf" container="true"> <class>ilog.tgo.model.IltShelf</class> <attribute name="slotSizes" javaClass="ilog.cpl.equipment.IlpSlotSizes"> <width> <value>60</value> <value>60</value> <value>60</value> </width> <height> <value>60</value> <value>60</value> <value>60</value> </height> </attribute> <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint"> <x>50</x> <y>50</y> </attribute> </addObject> <addObject id="card" container="true"> <class>ilog.tgo.model.IltCard</class> <parent>shelf</parent> <attribute name="name">card</attribute> <attribute name="position" javaClass="ilog.cpl.graphic.views.IlpShelfItemPosition"> <xIndex>0</xIndex> <yIndex>1</yIndex> <xSpan>1.8</xSpan> <ySpan>1.2</ySpan> </attribute> </addObject> </cplData>
// Creates a card carrier business object IltCardCarrier carrier = new IltCardCarrier((IltObjectState)null, 3); // Sets its position and shape carrier.setPosition(new IlpShelfItemPosition(50, 50, 100, 200)); // Creates a card business object IltCard card = new IltCard((IltObjectState)null, ""); // Sets its relative position to index x = 0, spanning over by 1.8 card.setPosition(new IlpShelfItemPosition(0, 0, 1.8f, 0)); // Sets the relationship between card and card carrier dataSource.setParent(card, carrier);
// Adds objects to the data source dataSource.addObject(carrier); dataSource.addOject(card);
<cplData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "ilog/cpl/schema/data.xsd"> <addObject id="carrier" container="true"> <class>ilog.tgo.model.IltCardCarrier</class> <attribute name="slotCount">3</attribute> <attribute name="position" javaClass="ilog.cpl.graphic.views.IlpShelfItemPosition"> <x>50</x> <y>50</y> <width>100</width> <height>200</height> </attribute> </addObject> <addObject id="card" container="true"> <class>ilog.tgo.model.IltCard</class> <parent>carrier</parent> <attribute name="name">card</attribute> <attribute name="position" javaClass="ilog.cpl.graphic.views.IlpShelfItemPosition"> <xIndex>0</xIndex> <yIndex>0</yIndex> <xSpan>1.8</xSpan> <ySpan>0</ySpan> </attribute> </addObject> </cplData>
top
. If this direction was set to
right
, the top right corner of the card would become the origin for
positioning the child objects. If the card was oriented in the
direction
bottom
, the (x,y) origin would be the lower right corner.
IlpRelativePoint
defines two attributes corresponding respectively to the
horizontal (
x
) and vertical (
y
) distance from the container (x,y) origin (which has the
position
(0,0)
).
// Creates a card business object IltCard card = new IltCard((IltObjectState)null, "card"); // Sets its position and shape card.setPosition(new IlpShelfItemPosition(50, 50, 50, 100)); // Creates a LED business object IltLed led = new IltLed("", IltLed.Type.Rectangular); // Sets its relative position, which is (10, 10) from the xy origin led.setPosition(new IlpRelativePoint(10, 10)); // Sets the relationship between LED and card dataSource.setParent(led, card); // Adds objects to the data source dataSource.addObject(card); dataSource.addObject(led);
<cplData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "ilog/cpl/schema/data.xsd"> <addObject id="card" container="true"> <class>ilog.tgo.model.IltCard</class> <attribute name="name">card</attribute> <attribute name="position" javaClass="ilog.cpl.graphic.views.IlpShelfItemPosition"> <x>50</x> <y>50</y> <width>50</width> <height>100</height> </attribute> </addObject> <addObject id="led"> <class>ilog.tgo.model.IltLed</class> <parent>card</parent> <attribute name="type">Rectangular</attribute> <attribute name="position" javaClass="ilog.cpl.graphic.IlpRelativePoint"> <x>10</x> <y>10</y> </attribute> </addObject> </cplData>