当前位置: 首页>>代码示例>>C++>>正文


C++ Stroke::addPoint方法代码示例

本文整理汇总了C++中Stroke::addPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ Stroke::addPoint方法的具体用法?C++ Stroke::addPoint怎么用?C++ Stroke::addPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stroke的用法示例。


在下文中一共展示了Stroke::addPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parseXML

void CReadXML::parseXML(TiXmlDocument* document){
    TiXmlElement* rootElement = document->RootElement();
	const char* name = rootElement->Attribute("name");
	character.setName(name);
	const char* seq = rootElement->Attribute("stroke_seq_id");
	character.setStrokeSeq(seq);
    TiXmlElement* outlineElement = rootElement->FirstChildElement();
    TiXmlElement* strokeElement = outlineElement->FirstChildElement();
    Bujian bujian;
    for (strokeElement;strokeElement;strokeElement = strokeElement->NextSiblingElement())
    {
        TiXmlElement* trunpoint = strokeElement->FirstChildElement();
        Stroke stroke;
        for (trunpoint;trunpoint;trunpoint = trunpoint->NextSiblingElement())
        {
            const char* x = trunpoint->Attribute("x");
            const char* y = trunpoint->Attribute("y");
            const char* statusPoint = trunpoint->Attribute("status");
            stroke.addStatus(statusPoint);
            stroke.addPoint(ccp(atof(x),atof(y)));
        }
        bujian.addStroke(stroke);
    }
    character.addBujian(bujian);
}
开发者ID:echenonline,项目名称:writing,代码行数:25,代码来源:ReadXML.cpp

示例2: lastPoint

GList * EraseableStroke::getStroke(Stroke * original) {
	XOJ_CHECK_TYPE(EraseableStroke);

	GList * list = NULL;

	Stroke * s = NULL;
	Point lastPoint(NAN, NAN);
	for (GList * l = this->parts->data; l != NULL; l = l->next) {
		EraseableStrokePart * p = (EraseableStrokePart *) l->data;
		GList * points = p->getPoints();
		if (g_list_length(points) < 2) {
			continue;
		}

		Point a = *((Point *) g_list_first(points)->data);
		Point b = *((Point *) g_list_last(points)->data);
		a.z = p->width;

		if (!lastPoint.equalsPos(a) || s == NULL) {
			if (s) {
				s->addPoint(lastPoint);
			}
			s = new Stroke();
			s->setColor(original->getColor());
			s->setToolType(original->getToolType());
			s->setWidth(original->getWidth());
			list = g_list_append(list, s);
		}
		s->addPoint(a);
		lastPoint = b;
	}
	if (s) {
		s->addPoint(lastPoint);
	}

	return list;
}
开发者ID:wbrenna,项目名称:xournalpp,代码行数:37,代码来源:EraseableStroke.cpp

示例3: makeCircleShape

/**
 * Create circle stroke for inertia
 */
Stroke* CircleRecognizer::makeCircleShape(Stroke* originalStroke, Inertia& inertia)
{
	int npts = (int) (2 * inertia.rad());
	if (npts < 12)
	{
		npts = 12; // min. number of points
	}

	Stroke* s = new Stroke();
	s->applyStyleFrom(originalStroke);

	for (int i = 0; i <= npts; i++)
	{
		double x = inertia.centerX() + inertia.rad() * cos((2 * M_PI * i) / npts);
		double y = inertia.centerY() + inertia.rad() * sin((2 * M_PI * i) / npts);
		s->addPoint(Point(x, y));
	}

	return s;
}
开发者ID:xournalpp,项目名称:xournalpp,代码行数:23,代码来源:CircleRecognizer.cpp


注:本文中的Stroke::addPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。