Exemplo n.º 1
0
 void
 updateNode(PropertyTree& node) {
   PropertyTree& attr_node = node.add("Attribute", "");
   attr_node.put("<xmlattr>.Name", name);
   attr_node.put("<xmlattr>.AttributeType", type);
   attr_node.put("<xmlattr>.Center", center);
   item.updateNode(attr_node);
 }
Exemplo n.º 2
0
    void
    updateNode(PropertyTree& node) {
      PropertyTree& geometry_node = node.add("Geometry", "");
      geometry_node.put("<xmlattr>.GeometryType", geometryType);

      for (auto& item : data_items) {
        item.updateNode(geometry_node);
      }
    }
Exemplo n.º 3
0
    void
    updateNode(PropertyTree& node) {
      std::stringstream ss;

      for (std::size_t d = 0; d < dimensions.size(); ++d) {
        if (ss.str().empty()) {
          ss << dimensions[d];
        } else {
          ss << ' ' << dimensions[d];
        }
      }

      PropertyTree& dat_node = node.add("DataItem", data);
      dat_node.put("<xmlattr>.Dimensions", ss.str());
      dat_node.put("<xmlattr>.NumberType", numberType);
      dat_node.put("<xmlattr>.Format", format);
    }
Exemplo n.º 4
0
  void MaterialObject::build() {
    check();
    if (!debugInactivate_()) {
      // for (auto& currentSensor : sensorNode_) {
      //   ReferenceSensor temporarySensor;
      //   temporarySensor.store(currentSensor.second);
      //   temporarySensor.check();
      //   temporarySensor.cleanup();

      //   std::cout << "[" << currentSensor.first << "]=" << temporarySensor.numChannels() << "; ";
      //   sensorChannels[currentSensor.first] = temporarySensor.numChannels();
      // }
      // std::cout << "}" << std::endl;
      

      static std::map<MaterialObjectKey, Materials*> materialsMap_; //for saving memory
      for (auto& currentMaterialNode : materialsNode_) {
        store(currentMaterialNode.second);

        check();
        if (type_().compare(getTypeString()) == 0) {
          MaterialObjectKey myKey(currentMaterialNode.first, sensorChannels, destination_.state()? destination_() : std::string(""));
          if (materialsMap_.count(myKey) == 0) {
            Materials * newMaterials  = new Materials(materialType_);
            newMaterials->store(currentMaterialNode.second);

            //pass destination to newMaterials
            if(destination_.state()) {
              PropertyTree destinationPt;
              destinationPt.add(destination_.name(), destination_());
              newMaterials->store(destinationPt);
            }

            newMaterials->build(sensorChannels);
            materialsMap_[myKey] = newMaterials;
          }
          materials_ = materialsMap_[myKey];

          break;
        }
      }

    }
    cleanup();
  }