| 146 | } |
| 147 | |
| 148 | void PLYParser::add_property(const std::string& elem_name, |
| 149 | const std::string& prop_name, size_t size) { |
| 150 | if (elem_name == "vertex") { |
| 151 | m_num_vertices = size; |
| 152 | } else if (elem_name == "face") { |
| 153 | m_num_faces = size; |
| 154 | } else if (elem_name == "voxel") { |
| 155 | m_num_voxels = size; |
| 156 | } |
| 157 | |
| 158 | std::string attr_name = form_attribute_name(elem_name, prop_name); |
| 159 | AttributeMap::const_iterator itr = m_attributes.find(attr_name); |
| 160 | if (itr == m_attributes.end()) { |
| 161 | m_attributes[attr_name] = std::vector<Float>(); |
| 162 | } else { |
| 163 | std::stringstream err_msg; |
| 164 | err_msg << "Duplicated property name: " << prop_name << std::endl; |
| 165 | err_msg << "PyMesh requires unique custom property names"; |
| 166 | throw IOError(err_msg.str()); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | void PLYParser::add_property_value(const std::string& elem_name, |
| 171 | const std::string& prop_name, Float value) { |