本文整理汇总了C++中nodes_t类的典型用法代码示例。如果您正苦于以下问题:C++ nodes_t类的具体用法?C++ nodes_t怎么用?C++ nodes_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了nodes_t类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: merge_interactive_selection
void merge_interactive_selection(const nodes_t& Nodes, const UpdatePolicyT& UpdatePolicy, const k3d::selection::records& InteractiveSelection)
{
for(nodes_t::const_iterator node = Nodes.begin(); node != Nodes.end(); ++node)
{
if(classes::MeshInstance() != (*node)->factory().factory_id())
continue;
imesh_selection_sink* const mesh_selection_sink = dynamic_cast<imesh_selection_sink*>(*node);
if(!mesh_selection_sink)
continue;
imesh_source* const mesh_source = dynamic_cast<imesh_source*>(*node);
if(!mesh_source)
continue;
const k3d::mesh* const mesh = boost::any_cast<k3d::mesh*>(mesh_source->mesh_source_output().property_internal_value());
if(!mesh)
continue;
const k3d::selection::set current_selection =
boost::any_cast<k3d::selection::set>(mesh_selection_sink->mesh_selection_sink_input().property_internal_value());
property::set_internal_value(mesh_selection_sink->mesh_selection_sink_input(), UpdatePolicy(*node, *mesh, current_selection, InteractiveSelection));
property::set_internal_value(**node, "show_component_selection", true);
}
}
开发者ID:AwesomeDoesIt,项目名称:k3d,代码行数:26,代码来源:selection.cpp
示例2: write_nodes_entry
void TORRENT_EXTRA_EXPORT write_nodes_entry(entry& r, nodes_t const& nodes)
{
bool ipv6_nodes = false;
entry& n = r["nodes"];
std::back_insert_iterator<std::string> out(n.string());
for (nodes_t::const_iterator i = nodes.begin()
, end(nodes.end()); i != end; ++i)
{
if (!i->addr().is_v4())
{
ipv6_nodes = true;
continue;
}
std::copy(i->id.begin(), i->id.end(), out);
write_endpoint(udp::endpoint(i->addr(), i->port()), out);
}
if (ipv6_nodes)
{
entry& p = r["nodes2"];
std::string endpoint;
for (nodes_t::const_iterator i = nodes.begin()
, end(nodes.end()); i != end; ++i)
{
if (!i->addr().is_v6()) continue;
endpoint.resize(18 + 20);
std::string::iterator out = endpoint.begin();
std::copy(i->id.begin(), i->id.end(), out);
out += 20;
write_endpoint(udp::endpoint(i->addr(), i->port()), out);
endpoint.resize(out - endpoint.begin());
p.list().push_back(entry(endpoint));
}
}
}
开发者ID:ycopy,项目名称:libtorrent,代码行数:35,代码来源:node.cpp
示例3: write_common
void xml_formatter::write_way(const element_info &elem, const nodes_t &nodes,
const tags_t &tags) {
writer->start("way");
write_common(elem);
for (nodes_t::const_iterator itr = nodes.begin(); itr != nodes.end(); ++itr) {
writer->start("nd");
writer->attribute("ref", *itr);
writer->end();
}
write_tags(tags);
writer->end();
}
开发者ID:tomhughes,项目名称:openstreetmap-cgimap,代码行数:15,代码来源:xml_formatter.cpp
示例4: write_common
void json_formatter::write_way(const element_info &elem, const nodes_t &nodes,
const tags_t &tags) {
writer->start_object();
write_common(elem);
writer->object_key("nds");
writer->start_array();
for (nodes_t::const_iterator itr = nodes.begin(); itr != nodes.end(); ++itr) {
writer->entry_int(*itr);
}
writer->end_array();
write_tags(tags);
writer->end_object();
}
开发者ID:Firefishy,项目名称:cgimap,代码行数:16,代码来源:json_formatter.cpp
示例5: str2node2
void str2node2 (const std::string& str, nodes_t& node)
{
//assert the node-id of a new node's parent is less than it
std::vector < std::string > tokens;
tokenize<std::string>(str, std::back_inserter(tokens));
unsigned int len = tokens.size() / 2;
node.resize (len);
std::vector <int> sibling (len);
for (unsigned int i=0; i<len; ++i){
node[i].val = SingleString::get()->getPointer(tokens[2*i]);
node[i].sibling = -1;
node[i].child = -1;
const int parent = atoi(tokens[2*i + 1].c_str()) -1;
node[i].parent = parent;
sibling[i] = -1;
const unsigned int here = i;
if (parent!=-1){
if (node[parent].child == -1) node[parent].child = here;
if (sibling[parent] != -1) node[sibling[parent]].sibling = here;
sibling[parent] = here;
};
};
}
开发者ID:kaihuangecnu,项目名称:freqt,代码行数:23,代码来源:freqt.hpp
示例6: str2node
void str2node (const std::string& str, nodes_t& node)
{
try {
unsigned int len = str.size();
unsigned int size = 0;
std::string buf = "";
std::vector <std::string> tmp;
for (unsigned int i = 0; i < len; i++) {
if (str[i] == '(' || str[i] == ')') {
if (! buf.empty()) {
tmp.push_back (buf);
buf = "";
++size;
}
if (str[i] == ')') tmp.push_back (")");
} else if (str[i] == '\t' || str[i] == ' ') { // do nothing
} else {
buf += str[i];
}
}
if (! buf.empty()) throw 2;
node.resize (size);
std::vector <int> sibling (size);
for (unsigned int i = 0; i < size; ++i) {
node[i].parent = -1;
node[i].child = -1;
node[i].sibling = -1;
sibling[i] = -1;
}
std::vector <int> sr;
unsigned int id = 0;
int top = 0;
for (unsigned int i = 0; i < tmp.size(); ++i) {
if (tmp[i] == ")") {
top = sr.size()-1;
if (top < 1) continue;
unsigned int child = sr[top];
unsigned int parent = sr[top-1];
node[child].parent = parent;
if (node[parent].child == -1) node[parent].child = child;
if (sibling[parent] != -1) node[sibling[parent]].sibling = child;
sibling[parent] = child;
sr.resize (top);
} else {
node[id].val = SingleString::get()->getPointer(tmp[i]);
sr.push_back (id);
id++;
}
}
return;
}
catch (const int) {
std::cerr << "Fatal: parse error << [" << str << "]\n";
std::exit (-1);
}
}
开发者ID:kaihuangecnu,项目名称:freqt,代码行数:61,代码来源:freqt.hpp
示例7: insert_node
// helper function
void insert_node(nodes_t& nodes, id_t const& name) {
nodes.insert(name);
}
开发者ID:boostorg,项目名称:graph,代码行数:4,代码来源:read_graphviz_spirit.hpp
示例8: modify_selected_meshes
void modify_selected_meshes(document_state& DocumentState, iplugin_factory* Modifier)
{
return_if_fail(Modifier);
idocument& document = DocumentState.document();
if (Modifier->implements(typeid(imulti_mesh_sink)))
{ // Mesh modifier taking multiple inputs
uint_t count = 0;
ipipeline::dependencies_t dependencies;
const nodes_t selected_nodes = selection::state(DocumentState.document()).selected_nodes();
// Create the node
inode* multi_sink = pipeline::create_node(document, *Modifier);
record_state_change_set changeset(document, string_cast(boost::format(_("Add Modifier %1%")) % Modifier->name()), K3D_CHANGE_SET_CONTEXT);
nodes_t nodes_to_delete;
for(nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node)
{
imesh_sink* const mesh_sink = dynamic_cast<imesh_sink*>(*node);
if(!mesh_sink)
continue;
imatrix_sink* const matrix_sink = dynamic_cast<imatrix_sink*>(*node);
iproperty* source_mesh = document.pipeline().dependency(mesh_sink->mesh_sink_input());
if (!source_mesh)
continue;
if (matrix_sink) // Insert a transform node
{
iproperty* const source_transformation = document.pipeline().dependency(matrix_sink->matrix_sink_input());
if (source_transformation)
{
inode* transform_points = plugin::create<inode>("TransformPoints", document, unique_name(document.nodes(), "TransformPoints"));
return_if_fail(transform_points);
imatrix_sink* transform_points_matrix_sink = dynamic_cast<imatrix_sink*>(transform_points);
return_if_fail(transform_points_matrix_sink);
imesh_sink* transform_points_mesh_sink = dynamic_cast<imesh_sink*>(transform_points);
return_if_fail(transform_points_mesh_sink);
dependencies.insert(std::make_pair(&transform_points_matrix_sink->matrix_sink_input(), source_transformation));
dependencies.insert(std::make_pair(&transform_points_mesh_sink->mesh_sink_input(), source_mesh));
imesh_source* transform_points_mesh_source = dynamic_cast<imesh_source*>(transform_points);
return_if_fail(transform_points_mesh_source);
source_mesh = &transform_points_mesh_source->mesh_source_output();
imesh_selection_sink* selection_sink = dynamic_cast<imesh_selection_sink*>(transform_points);
return_if_fail(selection_sink);
property::set_internal_value(selection_sink->mesh_selection_sink_input(), k3d::geometry::selection::create(1.0));
}
}
++count;
// Create a new user property
std::stringstream name, label;
name << "input_mesh" << count;
label << "Input Mesh " << count;
iproperty* sink = property::get(*multi_sink, name.str());
if (!sink)
sink = property::create<mesh*>(*multi_sink, name.str(), label.str(), "", static_cast<mesh*>(0));
// Store the connection
dependencies.insert(std::make_pair(sink, source_mesh));
// Delete the input node
nodes_to_delete.push_back(*node);
}
document.pipeline().set_dependencies(dependencies);
delete_nodes(document, nodes_to_delete);
// Give nodes a chance to initialize their property values based on their inputs, if any ...
if(ireset_properties* const reset_properties = dynamic_cast<ireset_properties*>(multi_sink))
reset_properties->reset_properties();
panel::mediator(DocumentState.document()).set_focus(*multi_sink);
}
else
{ // Normal mesh modifier
nodes_t new_modifiers;
const nodes_t selected_nodes = selection::state(DocumentState.document()).selected_nodes();
for(nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node)
{
new_modifiers.push_back(modify_mesh(DocumentState, **node, Modifier));
assert_warning(new_modifiers.back());
}
// Show the new modifier properties if only one was processed
if(selected_nodes.size() == 1)
{
panel::mediator(DocumentState.document()).set_focus(*new_modifiers.front());
}
else // otherwise connect all parameter properties to the first node and show that one
{
iproperty_collection* first_property_collection = dynamic_cast<iproperty_collection*>(new_modifiers.front());
if (first_property_collection)
{
// Get the in-and output property names, to exclude them from the connections
imesh_sink* const modifier_sink = dynamic_cast<imesh_sink*>(new_modifiers.front());
return_if_fail(modifier_sink);
imesh_source* const modifier_source = dynamic_cast<imesh_source*>(new_modifiers.front());
return_if_fail(modifier_source);
const std::string sink_name = modifier_sink->mesh_sink_input().property_name();
const std::string source_name = modifier_source->mesh_source_output().property_name();
ipipeline::dependencies_t dependencies;
const iproperty_collection::properties_t& first_properties = first_property_collection->properties();
nodes_t::iterator modifier = new_modifiers.begin();
++modifier;
for (modifier; modifier != new_modifiers.end(); ++modifier)
//.........这里部分代码省略.........
开发者ID:AwesomeDoesIt,项目名称:k3d,代码行数:101,代码来源:modifiers.cpp
示例9: do_insert_data
void do_insert_data(T data, Envelope<double> const& box, node * n, unsigned int& depth)
{
if (++depth >= max_depth_)
{
n->cont_.push_back(data);
}
else
{
Envelope<double> const& node_extent = n->extent();
Envelope<double> ext[4];
split_box(node_extent,ext);
for (int i=0;i<4;++i)
{
if (ext[i].contains(box))
{
if (!n->children_[i])
{
nodes_.push_back(new node(ext[i]));
n->children_[i]=&nodes_.back();
}
do_insert_data(data,box,n->children_[i],depth);
return;
}
}
n->cont_.push_back(data);
}
}
开发者ID:craton-,项目名称:php_mapnik,代码行数:27,代码来源:quad_tree.hpp
示例10: clear
void clear ()
{
Envelope<double> ext = root_->extent_;
nodes_.clear();
nodes_.push_back(new node(ext));
root_ = &nodes_[0];
}
开发者ID:craton-,项目名称:php_mapnik,代码行数:7,代码来源:quad_tree.hpp
示例11: write_tree
void tree::write_tree( ostream& os ) const
{
for( const_iterator i = nodes.begin(),
e = nodes.end();
i != e; ++i )
{
i->write_value( os );
if( const inner_node* p = dynamic_cast<const inner_node*>( &*i ) )
p->write_tree( os );
}
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:11,代码来源:tree_test.cpp
示例12: size
size_t tree::size() const
{
size_t res = 1;
for( const_iterator i = nodes.begin(),
e = nodes.end();
i != e; ++i )
{
res += i->node_size();
}
return res;
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:13,代码来源:tree_test.cpp
示例13: quad_tree
explicit quad_tree(Envelope<double> const& ext,
unsigned int max_depth = 8,
double ratio = 0.55)
: max_depth_(max_depth),
ratio_(ratio)
{
nodes_.push_back(new node(ext));
root_ = &nodes_[0];
}
开发者ID:craton-,项目名称:php_mapnik,代码行数:9,代码来源:quad_tree.hpp
示例14: find
tree::iterator tree::find( const string& match )
{
for( iterator i = nodes.begin(),
e = nodes.end();
i != e; ++i )
{
if( i->description() == match )
return i;
if( inner_node* p = dynamic_cast<inner_node*>( &*i ) )
{
iterator j = p->find( match );
if( j != p->child_end() )
return j;
}
}
return child_end();
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:20,代码来源:tree_test.cpp
示例15:
inline tree::const_iterator tree::child_end() const
{
return nodes.end();
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:4,代码来源:tree_test.cpp
示例16: end
iterator end()
{
return nodes_.end();
}
开发者ID:craton-,项目名称:php_mapnik,代码行数:4,代码来源:quad_tree.hpp
示例17: add_child
inline void tree::add_child( node* n )
{
nodes.push_back( n );
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:4,代码来源:tree_test.cpp
示例18: begin
iterator begin()
{
return nodes_.begin();
}
开发者ID:craton-,项目名称:php_mapnik,代码行数:4,代码来源:quad_tree.hpp
示例19: remove
inline void tree::remove( iterator n )
{
BOOST_ASSERT( n != nodes.end() );
nodes.erase( n );
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:5,代码来源:tree_test.cpp
示例20: swap
void swap( tree& r )
{ nodes.swap( r.nodes ); }
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:2,代码来源:tree_test.cpp
注:本文中的nodes_t类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论