Beispiel #1
0
void LeafNode::Parser(const Database& db)
{
	std::string filepath = db.GetDirPath() + "\\" + GetPath();

	// export name and out nodes
	JsonResParserOP parser(filepath, db, m_export_name, m_out_nodes);
	parser.Do();

	// in nodes
	std::set<int>::iterator itr = m_out_nodes.begin();
	for ( ; itr != m_out_nodes.end(); ++itr) 
	{
		if (*itr == -1) {
			continue;
		}
		const Node* to = db.Fetch(*itr);
		assert(to && to->Type() == NODE_LEAF);
		const_cast<LeafNode*>(static_cast<const LeafNode*>(to))->AddInput(GetID());		
	}

	// timestamp
	struct stat st;
	stat(filepath.c_str(), &st);
	m_timestamp = st.st_mtime;

	// md5
	m_md5.resize(32);
	MD5Helper::File(filepath, m_md5);	
}
Beispiel #2
0
void Snapshoot::Build(const Database& db, const std::string& dir)
{
	const std::vector<Node*>& nodes = db.GetNodes();
	for (int i = 0, n = nodes.size();  i < n; ++i)
	{
		Node* node = nodes[i];
		if (node->Type() != NODE_LEAF) {
			continue;
		}

		LeafNode* leaf = static_cast<LeafNode*>(node);
		const std::string& path = leaf->GetPath();

		std::string out_path = dir + "\\" + path;
		out_path = out_path.substr(0, out_path.find_last_of("."));
		out_path += "_ss.png";

		std::string dir = gum::FilepathHelper::Dir(out_path);
		if (!wxDir::Exists(dir)) {
			wxFileName::Mkdir(dir, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
		}

		s2::DrawRT rt;
		std::string ori_path = db.GetDirPath() + "\\" + path;
		auto sym = ee::SymbolMgr::Instance()->FetchSymbol(ori_path);
		rt.Draw(*sym);

		sm::vec2 sz = sym->GetBounding().Size();
		rt.StoreToFile(out_path, sz.x, sz.y);
	}
}