Difference between revisions of "DOM guide: Working with elements"

From COLLADA Public Wiki
Jump to: navigation, search
m (None)
Line 1: Line 1:
Two classes provide methods for working with elements after you have loaded a [[COLLADA instance document]] into your application:
+
== kid carrier ==
  
*<code>daeDatabase</code> provides access to elements within a document.
+
You might have not too long ago had a newborn, and also congratulations are in buy! These days you happen to be itching to leave your home, reach the actual trail and even embark on trip. One of the simplest ways to carry your child whilst the hands totally free is by using a youngster provider. Here's the way to shop.
*<code>daeElement</code> is the base class for all [[COLLADA Object Model]] classes. This class uses the [[Reflective Object System]] (ROS) to provide considerable functionality without the need to use the generated subclass.
 
  
==Querying Database Elements==
 
The current version of the [[COLLADA DOM]] provides two methods to query the database to get
 
information about specific elements:
 
*<code>daeDatabase::getElementCount</code>
 
*<code>daeDatabase::getElement</code>
 
  
:'''''Note:''' <code>domConstants.h</code> provides constants for the element tag names (<code>COLLADA_ELEMENT_*</code>) and the element types (<code>COLLADA_TYPE_*</code>). When querying the database for elements based on type, always use the <code>COLLADA_TYPE_*</code> constant.''
 
  
===getElementCount===
+
The basic principles of Youngster Providers
<code>getElementCount</code> returns the number of elements for a particular query. For example, the following code asks how many <image> elements are in the database:
 
imageCount = collada_dom->getDatabase()->getElementCount(NULL, COLLADA_TYPE_IMAGE, NULL);
 
The additional parameters to <code>getElementCount</code> make the request more specific. The first parameter represents the ID of the element. The third parameter represents the name of the document, and might be used if you have loaded elements from multiple instance documents.
 
  
===getElement===
 
<code>getElement</code> requests that the database return a specific element. For example, the
 
following code returns an <image> element with an index that matches the value in el_number.
 
domImage *thisImage;
 
daeInt error = collada_dom->getDatabase()->getElement((daeElement**)&thisImage, el_number, NULL, COLLADA_TYPE_IMAGE, NULL);
 
  
The element itself is returned in the first parameter. The third parameter restricts the query to a specific element by ID, and the fifth parameter restricts the search to a specific document.
 
  
===Technique for querying elements===
+
Your first choice for an infant is an child service provider. It is a easy, frameless group that snuggles your child in the front person. Nearly all hold a child plus some infant equipment with a complete fat as high as Twenty-five or Thirty weight. Toddler carriers are beautifully easy regarding around-town use as well as air travel.
Typically, <code>getElementCount</code> and <code>getElement</code> are used as a pair, first getting the number of elements that match a particular ID, type, or document query, and then iterating through those by using the <code>getElement</code> method. For example, if you want to take an action on all of the images in the database, you could do the following:
 
  
imageCount = collada_dom->getDatabase()->getElementCount(NULL, COLLADA_TYPE_IMAGE, NULL);
 
for (unsigned int i=0; i<imageCount; i++)
 
{
 
    error = collada_dom->getDatabase()->getElement((daeElement**)&thisImage, i, NULL, COLLADA_TYPE_IMAGE, NULL);
 
    /* take action on this image */
 
}
 
  
As another example, to take action on all images with the ID “landImage”, you could do the following:
 
imageCount = collada_dom->getDatabase()->getElementCount("landImage", COLLADA_TYPE_IMAGE, NULL);
 
for (unsigned int i=0; i<imageCount; i++)
 
{
 
    error = collada_dom->getDatabase()->getElement((daeElement**)&thisImage, i, "landImage", COLLADA_TYPE_IMAGE, NULL);
 
    /* take action on this land image */
 
}
 
  
The index passed to <code>getElement</code> is not directly associated with the element within the database. The index relates to the query itself. The queries used for <code>getElementCount</code> and <code>getElement</code> must match in order for the index to be valid when passed to the <code>getElement</code> method.
+
A youngster company typically carries a shape which is made to carry a larger youngster powering a person. To train on a kid service provider, a youngster must be able to sitting up without having support. The tiniest little one suitable for a young child carrier is all about Sixteen pounds., which usually typically indicates a kid with regards to Six or perhaps Eight a few months old. In case unsure concerning your son or daughter's ability, seek advice from your physician prior to venturing out. The largest child proper to be able to journey in a very carrier is about 40 weight., with some versions assisting better pounds to allow for products, too.
  
==Determining an Element's Type==
 
There are three approaches to determining the type of a <code>daeElement</code>:
 
  
* Using the <code>daeElement::getElementType</code> method, which returns an enumerated value respresenting the element's type. The values returned by this function are in the <code>dom/domTypes.h</code> header. This is the easiest approach.
 
  
*Using the <code>daeElement::getTypeName</code> method, which returns a <code>daeString</code> containing the type name. To determine the type, compare this string with the matching <code>COLLADA_TYPE_*</code> constant defined in <code>dom/domConstants.h</code>.
+
Youngster companies are a great selection for vacation, walking and use around town. Because the extra fat and movement of your respective little one might cause one to shed the account balance, child companies are not suitable for trekking upon reduce rock and roll, climbing, snowboarding, inline skateboarding, biking or other high-speed actions.
  
*By comparing the <code>daeElement::_meta</code> variable. The <code>_meta</code> is a pointer to a <code>daeMetaElement</code>, which is the class that contains all the ROS information for an element type. By doing a pointer comparison on <code>daeElement::getMeta</code> and the generated class's static <code>dom*::_Meta</code>, it is possible to find the element type. This is the approach that the <code>daeSafeCast</code> method uses to ensure type safety.  (See also: [[DOM meta system]].)
 
  
'''''NOTE:''' The <code>daeSafeCast</code> and <code>daeElement::getElementType</code> approaches are newer additions to the COLLADA DOM. When looking at older source code using the DOM, expect to see the older methods used frequently for type checking.''
 
  
==Determining an Element's Name==
+
Compare Features
Use the <code>daeElement:getElementName</code> method to retrieve the name of an element. The element name is the XML tag that would be present in a COLLADA instance document.
 
For the majority of elements in the COLLADA DOM, <code>getElementName</code>  returns NULL, indicating that the element's name is the same as its type name, available from <code>daeElement::getTypeName</code>.
 
  
==Accessing Element Data==
 
The easiest way to access element data is to cast the <code>daeElement</code> to its strongly typed subclass. However, at times, it might not be possible to do the cast or it might be more convenient not to cast. The <code>daeElement</code> class provides methods to access and manipulate data directly for such situations.
 
  
===Navigating the Object Model===
 
<code>daeElement</code> provides the following methods for accessing various information about an element:
 
  
*<code>getDocument</code> provides access to the [[COLLADA document]] that the element belongs to. 
 
  
*<code>getDocumentURI</code> is a helper method if you need only the document's name.
 
  
*<code>getParentElement</code> returns the parent element, which allows you to traverse up the tree to the root. If this method returns NULL, the element is the root of the tree. If the root element belongs to a document (<code>getDocument</code> or <code>getDocumentURI</code> are non-NULL) then it is safe to assume that the element is a <code>domCOLLADA</code> element, which is an element that is the root of a COLLADA document.
+
The majority of little one companies discuss simple capabilities including adaptable neck and also waist connectors, variable little one control, a new foldout kickstand as well as an outside frame. Match is vital. Megan Nelson, REI Washington supply professional, provides these tips: "The match can be like a new backpack, except the extra weight voyages greater. Nevertheless, the body weight in fact is little of an concern if the little one service provider suits you proper.Inches
  
*<code>getChildren</code> populates an array with the children of an element. This allows you to iterate over all the children of an element and traverse down the element hierarchy. This array is ordered the same as it would be if the element were written to a [[COLLADA instance document]]. This array is the same as the <code>_contents</code> array, if an element's dom* subclass has a <code>_contents</code> array.
 
  
===Accessing Attributes===
 
The <code>daeElement</code> class provides many functions for accessing the attributes that an element may have:
 
*<code>setAttribute</code> takes both the attribute name and the new value as string arguments. The COLLADA DOM converts the value from a string to the data type of the attribute. This method returns false if the element does not have an attribute with the specified name.
 
*<code>hasAttribute</code> queries the existence of an attribute.
 
*<code>isAttributeSet</code> returns true if the attribute exists and has been set. The attribute can be set when loading the document or programmatically. Attributes with default values are always considered set.
 
*<code>getAttributeValue</code> returns a byte pointer to the memory used to store the specified attribute. The client application is responsible for type casting this pointer to the appropriate type before using it. One common mistake occurs when dealing with string attributes. Remember that this function returns a pointer to the data and that <code>daeString</code> is a pointer itself, therefore this function returns a pointer to a pointer for string attributes.
 
  
===Accessing the Value===
+
Here are some of the factors to take into consideration:
*The daeElement::hasValue method is used to query if an element has a value.
 
*The daeElement::getValuePointer method works the same as daeElement::getAttributeValue except that it returns a pointer to the value field.
 
  
==Adding and Removing Elements==
 
The <code>daeElement</code> class provides methods for adding elements to, and removing them from, the Object Model. Using these methods ensures that the element bookkeeping information maintained by the COLLADA DOM is appropriately updated. For example, many DOM classes contain a <code>_contents</code> array, which keeps the correct order of all the child elements of that DOM class so they can be written in the valid order. The DOM maintains the <code>_contents</code> array automatically when you use these methods to create and delete child elements.
 
  
'''''Note.''' We strongly advise againt manually updating the <code>_contents</code> array as it is very error-prone.''
 
  
===Adding Elements===
+
Headgear program: This can be a step to parental comfort and ease. Most child carriers attribute a good easy-to-adjust ladder suspensions, just as the kinds present in a lot of back packs. A kid carrier's adjustability is actually measured with the <span class="plainlinks">[http://www.thepiggybackrider.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;/*CITATION*/">kid carrier</span>]</span> upper body assortment (outlined within the Specs bill upon REI.net product or service pages). Continue reading about how to be able to evaluate the torso sizing. Core adjustments are quite obvious: In case you are around the tall part, move your suspension setting up increased around the again (as well as, if you're a shorter adult, move that to a reduce establishing). A number of versions include a set suspensions, that limitations adjustability, yet provide pounds personal savings.
The method <code>daeElement::createAndPlace</code> creates a new element as a child of the current element. It places the new element in the appropriate field of its parent element based on the <code>className</code> parameter provided in the method invocation.
 
  
The following example demonstrates how to add a new light to an existing library of lights:
 
// Add a new light to the library
 
domLight *newLight = daeSafeCast<domLight>(myLib->createAndPlace(COLLADA_ELEMENT_LIGHT));
 
// Now you can add data to the new light.
 
  
:'''''Note:''' The <code>daeElement::create*</code> methods work with element tag names, not element types. When using the string constants provided in <code>domConstants.h</code>, use the <code>COLLADA_ELEMENT_*</code> value and not the <code>COLLADA_TYPE_*</code>. This is in contrast to working with the database, which uses element types.''
 
  
===Removing Elements===
+
Kickstand: This kind of club offers a dependable system with regard to filling and unloading your child. The majority of can be physically expanded as well as retracted on the launching place having a simple tug. Various other versions feature a fixed-position kickstand (which usually saves a certain amount of fat) or a spring-loaded kickstand (which usually expands and folds over automatically-a great characteristic). These all complete exactly the same objective, thus private preference will be the deciding issue below.
To remove a child element from its parent element, you can use either of the following methods; the results are identical, but one might better suit your coding style:
 
* <code>daeElement::removeChildElement</code>
 
* <code>daeElement::removeFromParent</code>, which is a static method that finds the parent object automatically.  
 
  
The following example demonstrates one way to remove a light from a library of lights:
 
daeElement* lightParent = myLight->getParentElement();
 
// Remove the light
 
daeBool removed = lightParent->removeChildElement(myLight);
 
  
Here is the other method:
 
// Remove the light from its parent
 
daeBool removed = daeElement::removeFromParent(myLight);
 
  
==Moving Elements==
+
Body: As known previously, frameless service providers are intended limited to newborns as well as products amassing up to 25 lbs. or so. Many kid carriers characteristic an outside frame associated with tubular aluminum. A few versions make use of an aluminium keep pertaining to assistance, just like those utilized in internal-frame backpacks, and may offer a daypack selection.
To move an element from one parent to another, use  <code>daeElement::placeElement</code>. <code>placeElement</code>  handles all the "bookkeeping" for you. The element passed to <code>placeElement</code> is removed from its old location and inserted as a child to the element <code>placeElement</code> was called on. If the new parent belongs to a different document, <code>placeElement</code>  updates all  the document references and the runtime database.  
 
  
<code>placeElement</code>  automatically inserts the new child in a valid location within the parent's content model. There may be many valid locations for the new child, but <code>placeElement</code> inserts the child in the first one available. To insert the new child at a specific location, use the <code>placeElementAt</code>, <code>placeElementBefore</code>, or <code>placeElementAfter</code> methods.
 
  
==Copying Elements==
 
To copy a DOM element, rather than using the assignment operator, use the <code>daeElement::clone</code> method, which provides a deep copy operation. After the element is cloned, you need to resolve any URIs that have been copied, as <code>clone</code> does not do that automatically.
 
  
The DOM type <code>daeString</code>, used in many objects derived from the <code>daeElement</code> class, is a C-style string and not a C++ string class. If you use the assignment operator to copy a <code>daeString</code>, you can end up with a dangling pointer if the original string is deleted.
+
Components: If you are considering employing a youngster service provider very rarely, you may not want to consider full functionalities in the luxurious versions. However, if you're going to move off-road or even have plenty of items, consider models while using next additional:
  
{{DOM navigation}}
 
  
[[Category:COLLADA DOM|Elements]]
+
 
 +
Gear-storage capacity, which include removable baby diaper luggage or day packages
 +
 
 +
More flexibleness choices for a greater suit
 +
 
 +
Diaper-changing sleep pad
 +
 
 +
Hydration-system compatibility
 +
 
 +
Detachable rain/sun engine (often distributed individually)
 +
 
 +
Completely removable insect netting (usually sold individually)
 +
 
 +
Suit the kid Service provider for your requirements
 +
 
 +
 
 +
 
 +
First, adjust the little one service provider to suit a person. This can be a main factor for your convenience. When generating the initial alterations, employ textbooks in order to fat the rest instead of your child.
 +
 
 +
 
 +
 
 +
 
 +
 
 +
Modify the headgear technique to match your body, so that the hipbelt is situated on the cool bone fragments (certainly not your own waist) as well as the shoulder straps relaxation in your shoulder blades.
 +
 
 +
Tighten the hipbelt thus around 80% with the fat is on your sides.
 +
 
 +
Tense up the tie and so the little one service provider is actually settled down and also the remaining 20% approximately of the pounds will be on your own shoulder muscles.
 +
 
 +
Alter your sternum straps throughout the chest so it does not interfere with your current inhaling.
 +
 
 +
Match the kid Service provider for your Little one
 +
 
 +
 
 +
 
 +
Before adding your child in the company, adjust the peak in the youngster seat. Ensure that the child's band tend to be loose along with the kickstand is actually entirely prolonged.
 +
 
 +
 
 +
 
 +
Currently put your child inside the service provider, and make certain their foot occur through the lower-leg openings.
 +
 
 +
Gear as well as tense up all shoulder straps, like the hipbelt, connectors, lower-leg band alterations and also breast bone strap. Notice: Its not all kid providers supply of those tie alternatives.
 +
 
 +
Tense up the side compression setting shoulder straps, in the event that accessible.
 +
 
 +
Check to ensure the child's connectors suit effortlessly over their shoulder muscles knowning that the lower limb straps are happy.
 +
 
 +
Advice on Utilizing a Child Carrier
 +
 
 +
 
 +
 
 +
Raising a great busy kid service provider is comparable to hoisting a whopping backpack (discover our pack-hoisting movie with regard to recommendations). The initial few occasions you need to do so, have someone allow you to use it your own again. The particular measures: Lift a child company from the top addresses, wear the particular band and also belt the actual hipbelt. When detaching the service provider, loosen the particular connectors and unbuckle the particular hipbelt. Snagging the particular handle guiding your brain, provide the actual service provider all around for a top, and also hold the subsequent manage that will help you established the kid service provider in the grass.
 +
 
 +
 
 +
 
 +
Some extra pointers:
 +
 
 +
 
 +
 
 +
Do not depart your son or daughter unattended while he as well as she actually is in the kid provider.
 +
 
 +
Youngsters have a tendency to drift off in child service providers; at times look at the little one's situation and comfort.
 +
 
 +
Child service providers usually are not effectively steady to use as a seat, neither whenever they be placed on elevated areas such as a regular, kitchen table as well as your bed.
 +
 
 +
Avoid the use of a kid provider when the shape as well as nails are generally damaged.
 +
 
 +
Be sure your son or daughter is protected from the weather conditions.
 +
 
 +
Consider sporting the loath so that your little one cannot seize flowing hair

Revision as of 06:09, 26 September 2011

kid carrier

You might have not too long ago had a newborn, and also congratulations are in buy! These days you happen to be itching to leave your home, reach the actual trail and even embark on trip. One of the simplest ways to carry your child whilst the hands totally free is by using a youngster provider. Here's the way to shop.


The basic principles of Youngster Providers


Your first choice for an infant is an child service provider. It is a easy, frameless group that snuggles your child in the front person. Nearly all hold a child plus some infant equipment with a complete fat as high as Twenty-five or Thirty weight. Toddler carriers are beautifully easy regarding around-town use as well as air travel.


A youngster company typically carries a shape which is made to carry a larger youngster powering a person. To train on a kid service provider, a youngster must be able to sitting up without having support. The tiniest little one suitable for a young child carrier is all about Sixteen pounds., which usually typically indicates a kid with regards to Six or perhaps Eight a few months old. In case unsure concerning your son or daughter's ability, seek advice from your physician prior to venturing out. The largest child proper to be able to journey in a very carrier is about 40 weight., with some versions assisting better pounds to allow for products, too.


Youngster companies are a great selection for vacation, walking and use around town. Because the extra fat and movement of your respective little one might cause one to shed the account balance, child companies are not suitable for trekking upon reduce rock and roll, climbing, snowboarding, inline skateboarding, biking or other high-speed actions.


Compare Features



The majority of little one companies discuss simple capabilities including adaptable neck and also waist connectors, variable little one control, a new foldout kickstand as well as an outside frame. Match is vital. Megan Nelson, REI Washington supply professional, provides these tips: "The match can be like a new backpack, except the extra weight voyages greater. Nevertheless, the body weight in fact is little of an concern if the little one service provider suits you proper.Inches


Here are some of the factors to take into consideration:


Headgear program: This can be a step to parental comfort and ease. Most child carriers attribute a good easy-to-adjust ladder suspensions, just as the kinds present in a lot of back packs. A kid carrier's adjustability is actually measured with the kid carrier upper body assortment (outlined within the Specs bill upon REI.net product or service pages). Continue reading about how to be able to evaluate the torso sizing. Core adjustments are quite obvious: In case you are around the tall part, move your suspension setting up increased around the again (as well as, if you're a shorter adult, move that to a reduce establishing). A number of versions include a set suspensions, that limitations adjustability, yet provide pounds personal savings.


Kickstand: This kind of club offers a dependable system with regard to filling and unloading your child. The majority of can be physically expanded as well as retracted on the launching place having a simple tug. Various other versions feature a fixed-position kickstand (which usually saves a certain amount of fat) or a spring-loaded kickstand (which usually expands and folds over automatically-a great characteristic). These all complete exactly the same objective, thus private preference will be the deciding issue below.


Body: As known previously, frameless service providers are intended limited to newborns as well as products amassing up to 25 lbs. or so. Many kid carriers characteristic an outside frame associated with tubular aluminum. A few versions make use of an aluminium keep pertaining to assistance, just like those utilized in internal-frame backpacks, and may offer a daypack selection.


Components: If you are considering employing a youngster service provider very rarely, you may not want to consider full functionalities in the luxurious versions. However, if you're going to move off-road or even have plenty of items, consider models while using next additional:


Gear-storage capacity, which include removable baby diaper luggage or day packages

More flexibleness choices for a greater suit

Diaper-changing sleep pad

Hydration-system compatibility

Detachable rain/sun engine (often distributed individually)

Completely removable insect netting (usually sold individually)

Suit the kid Service provider for your requirements


First, adjust the little one service provider to suit a person. This can be a main factor for your convenience. When generating the initial alterations, employ textbooks in order to fat the rest instead of your child.



Modify the headgear technique to match your body, so that the hipbelt is situated on the cool bone fragments (certainly not your own waist) as well as the shoulder straps relaxation in your shoulder blades.

Tighten the hipbelt thus around 80% with the fat is on your sides.

Tense up the tie and so the little one service provider is actually settled down and also the remaining 20% approximately of the pounds will be on your own shoulder muscles.

Alter your sternum straps throughout the chest so it does not interfere with your current inhaling.

Match the kid Service provider for your Little one


Before adding your child in the company, adjust the peak in the youngster seat. Ensure that the child's band tend to be loose along with the kickstand is actually entirely prolonged.


Currently put your child inside the service provider, and make certain their foot occur through the lower-leg openings.

Gear as well as tense up all shoulder straps, like the hipbelt, connectors, lower-leg band alterations and also breast bone strap. Notice: Its not all kid providers supply of those tie alternatives.

Tense up the side compression setting shoulder straps, in the event that accessible.

Check to ensure the child's connectors suit effortlessly over their shoulder muscles knowning that the lower limb straps are happy.

Advice on Utilizing a Child Carrier


Raising a great busy kid service provider is comparable to hoisting a whopping backpack (discover our pack-hoisting movie with regard to recommendations). The initial few occasions you need to do so, have someone allow you to use it your own again. The particular measures: Lift a child company from the top addresses, wear the particular band and also belt the actual hipbelt. When detaching the service provider, loosen the particular connectors and unbuckle the particular hipbelt. Snagging the particular handle guiding your brain, provide the actual service provider all around for a top, and also hold the subsequent manage that will help you established the kid service provider in the grass.


Some extra pointers:


Do not depart your son or daughter unattended while he as well as she actually is in the kid provider.

Youngsters have a tendency to drift off in child service providers; at times look at the little one's situation and comfort.

Child service providers usually are not effectively steady to use as a seat, neither whenever they be placed on elevated areas such as a regular, kitchen table as well as your bed.

Avoid the use of a kid provider when the shape as well as nails are generally damaged.

Be sure your son or daughter is protected from the weather conditions.

Consider sporting the loath so that your little one cannot seize flowing hair