本文整理汇总了C++中Chart类的典型用法代码示例。如果您正苦于以下问题:C++ Chart类的具体用法?C++ Chart怎么用?C++ Chart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Chart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_sub_production
_sub_production_ast handle_sub_production(string& input, Production& p, Chart& chart)
{
int64_t setIndex;
size_t stateIndex;
Production production;
_sub_production_ast out;
_symbol_ast symbol;
switch(p.number()){
case 0: //symbol ws sub_production
tie(setIndex, stateIndex) = p.symbolInfo(0);
production = chart.getState(setIndex, stateIndex).first;
symbol = handle_symbol(input, production, chart);
//Skip ws
tie(setIndex, stateIndex) = p.symbolInfo(2);
production = chart.getState(setIndex, stateIndex).first;
out = handle_sub_production(input, production, chart);
out.insert(out.begin(), symbol);
return out;
case 1: //symbol
tie(setIndex, stateIndex) = p.symbolInfo(0);
production = chart.getState(setIndex, stateIndex).first;
symbol = handle_symbol(input, production, chart);
out.push_back(symbol);
return out;
default:;
}
return out;
}
示例2: onActionFetchLayersFromDBTriggered
void ChartEditorWindow::onActionFetchLayersFromDBTriggered(){
Chart chart;
QString qSqlDriverStr;
LayerSelectionItem* selItem;
QString layerId;
QStringList layerIdList;
layerSelectionVector.clear();
if(settingsManager->getDBDriver() == "MySQL")
qSqlDriverStr = "QMYSQL";
else if (settingsManager->getDBDriver() == "PostgreSQL")
qSqlDriverStr = "QPSQL";
chart.setOGRDriverQt(qSqlDriverStr);
layerIdList << chart.getSimplifiedLayers();
QStringListIterator layerIdListIt(layerIdList);
while(layerIdListIt.hasNext()){
layerId = layerIdListIt.next();
selItem = new LayerSelectionItem(layerId, true);
layerSelectionVector << selItem;
}
showLayers();
}
示例3: handle_file
_file_ast handle_file(string& input, Production& p, Chart& chart)
{
int64_t setIndex;
size_t stateIndex;
Production production;
_production_ast p_ast;
_file_ast out;
switch (p.number()){
case 0: //production ws ";" ws file
//production
tie(setIndex, stateIndex) = p.symbolInfo(0);
production = chart.getState(setIndex, stateIndex).first;
p_ast = handle_production(input, production, chart);
//We don't care about whitespace or the symbol in this case
tie(setIndex, stateIndex) = p.symbolInfo(4);
production = chart.getState(setIndex, stateIndex).first;
out = handle_file(input, production, chart);
out.push_back(p_ast);
return out;
case 1: // production ws ";" ws
//This is the terminal file make a new
//production
tie(setIndex, stateIndex) = p.symbolInfo(0);
production = chart.getState(setIndex, stateIndex).first;
p_ast = handle_production(input, production, chart);
out = _file_ast({p_ast});
return out;
default:
break;
}
return _file_ast{};
}
示例4: queue
void Atlas::extractCharts()
{
const uint faceCount = m_mesh->faceCount();
int first = 0;
Array<uint> queue(faceCount);
BitArray bitFlags(faceCount);
bitFlags.clearAll();
for (uint f = 0; f < faceCount; f++)
{
if (bitFlags.bitAt(f) == false)
{
// Start new patch. Reset queue.
first = 0;
queue.clear();
queue.append(f);
bitFlags.setBitAt(f);
while (first != queue.count())
{
const HalfEdge::Face * face = m_mesh->faceAt(queue[first]);
// Visit face neighbors of queue[first]
for (HalfEdge::Face::ConstEdgeIterator it(face->edges()); !it.isDone(); it.advance())
{
const HalfEdge::Edge * edge = it.current();
nvDebugCheck(edge->pair != NULL);
if (!edge->isBoundary() && /*!edge->isSeam()*/
//!(edge->from()->tex() != edge->pair()->to()->tex() || edge->to()->tex() != edge->pair()->from()->tex()))
!(edge->from() != edge->pair->to() || edge->to() != edge->pair->from())) // Preserve existing seams (not just texture seams).
{
const HalfEdge::Face * neighborFace = edge->pair->face;
nvDebugCheck(neighborFace != NULL);
if (bitFlags.bitAt(neighborFace->id) == false)
{
queue.append(neighborFace->id);
bitFlags.setBitAt(neighborFace->id);
}
}
}
first++;
}
Chart * chart = new Chart();
chart->build(m_mesh, queue);
m_chartArray.append(chart);
}
}
}
示例5: process_internal_rules
void ParserCKYBest::process_internal_rules(Chart& chart) const
{
unsigned sent_size=chart.get_size();
for (unsigned span = 2; span <= sent_size; ++span) {
unsigned end_of_begin=sent_size-span;
for (unsigned begin=0; begin <= end_of_begin; ++begin) {
unsigned end = begin + span -1;
// std::cout << "begin: " << begin << ", end: " << end << std::endl;
Cell& result_cell = chart.access(begin,end);
if(!result_cell.is_closed()) {
// look for all possible new edges
for (unsigned m = begin; m < end; ++m) {
const Cell& left_cell = chart.access(begin,m);
if(!left_cell.is_closed()) {
const Cell& right_cell = chart.access(m+1,end);
if( !right_cell.is_closed())
get_candidates(left_cell,right_cell,result_cell);
}
}
// std::cout << result_cell << std::endl;
add_unary(result_cell, span == sent_size);
// result_cell.apply_beam();
}
// std::cout << result_cell << std::endl;
}
}
}
示例6: Run
void Run()
{
int i;
Chart a;
ifstream input("input.txt");
input>>i;
for(int j=0; j<i;j++)
{
string s;
input>>s;
if(s=="VOTE")
{
string s1;
int q;
input>>s1>>q;
a.VoteRecord(s1,q);
}
if(s=="TOP")
{
string s1;
int q;
input>>s1>>q;
vector<int> b;
b=a.GetTop(s1,q);
cout<<"Топ для "<<s1<<":\n";
for(int i=0;i<b.size();i++)
cout<<b[i]<<" ";
cout<<"\n";
}
示例7: handle_rhs
_rhs_ast handle_rhs(string& input, Production& p, Chart& chart)
{
int64_t setIndex;
size_t stateIndex;
Production production;
_rhs_ast out;
_sub_production_ast subProd;
switch(p.number()){
case 0: //sub_production ws "|" ws rhs | sub_production
tie(setIndex, stateIndex) = p.symbolInfo(0);
production = chart.getState(setIndex, stateIndex).first;
subProd = handle_sub_production(input, production, chart);
tie(setIndex, stateIndex) = p.symbolInfo(4);
production = chart.getState(setIndex, stateIndex).first;
out = handle_rhs(input, production, chart);
out.push_back(subProd);
return out;
case 1:
tie(setIndex, stateIndex) = p.symbolInfo(0);
production = chart.getState(setIndex, stateIndex).first;
subProd = handle_sub_production(input, production, chart);
out.push_back(subProd);
return out;
default:;
}
return out;
}
示例8: handle_production
_production_ast handle_production(string& input, Production& p, Chart& chart)
{
int64_t setIndex;
size_t stateIndex;
Production production;
_production_ast out = _production_ast();
//No cases so no switch
//non_terminal option ws ":=" ws rhs
tie(setIndex, stateIndex) = p.symbolInfo(0);
production = chart.getState(setIndex, stateIndex).first;
_non_terminal_ast name = handle_non_terminal(input, production, chart);
out.name_ = name;
tie(setIndex, stateIndex) = p.symbolInfo(1);
if(setIndex > 0) { //If it has a negative setIndex it was skipped
production = chart.getState(setIndex, stateIndex).first;
_option_ast option = handle_option(input, production, chart);
if (option == "nullable") {
out.nullable_ = true;
} else {
out.nullable_ = false;
}
}
tie(setIndex, stateIndex) = p.symbolInfo(5);
production = chart.getState(setIndex, stateIndex).first;
_rhs_ast rhs = handle_rhs(input, production, chart);
out.sub_productions_ = rhs;
return out;
}
示例9: parse
void ParserCKYBest::parse(Chart& chart) const
{
bool isroot = chart.get_size() == 1;
for(unsigned i = 0; i < chart.get_size(); ++i) {
// std::cout << "initialising position: " << i << std::endl;
add_unary_init(chart.access(i,i),isroot);
// std::cout << chart.access(i,i) << std::endl;
}
process_internal_rules(chart);
}
示例10: fixed
void
CrossSectionWindow::PaintGrid(Canvas &canvas, Chart &chart)
{
canvas.SetTextColor(look.text_color);
chart.DrawXGrid(Units::ToSysDistance(fixed(5)), fixed_zero,
look.grid_pen, fixed(5), true);
chart.DrawYGrid(Units::ToSysAltitude(fixed(1000)), fixed_zero,
look.grid_pen, fixed(1000), true);
chart.DrawXLabel(_T("D"));
chart.DrawYLabel(_T("h"));
}
示例11: createBranchMarker
/**
* \brief create a branch marker between two nodes and store it into marker array
*/
virtual void createBranchMarker(const Chart &child, const Chart &parent)
{
if (!markers){
ROS_WARN_THROTTLE(30,"[ExplorerBase::%s]\tNo marker array to update is provided, visualization is disabled.",__func__);
return;
}
geometry_msgs::Point e;
geometry_msgs::Point s;
visualization_msgs::Marker branch;
branch.header.frame_id = mark_frame;
branch.header.stamp = ros::Time();
branch.lifetime = ros::Duration(0.5);
branch.ns = "Atlas Branches";
//need to know the branch id, too bad branches don't have it.
//Lets use Cantor pairing function: 0.5(a+b)(a+b+1)+b
branch.id = 0.5*(child.getId() + parent.getId())*(child.getId()+parent.getId()+1) + parent.getId();
branch.type = visualization_msgs::Marker::LINE_STRIP;
branch.action = visualization_msgs::Marker::ADD;
s.x = child.getCenter()[0];
s.y = child.getCenter()[1];
s.z = child.getCenter()[2];
branch.points.push_back(s);
e.x = parent.getCenter()[0];
e.y = parent.getCenter()[1];
e.z = parent.getCenter()[2];
branch.points.push_back(e);
branch.scale.x = 0.005;
branch.color.a = 1.0;
branch.color.r = 0.0;
branch.color.g = 0.0;
branch.color.b = 0.9;
std::lock_guard<std::mutex> guard(*mtx_ptr);
markers->markers.push_back(branch);
}
示例12: handleRecurrence
int CmdBurndownMonthly::execute (std::string& output)
{
int rc = 0;
// Scan the pending tasks, applying any filter.
handleRecurrence ();
std::vector <Task> filtered;
filter (filtered);
context.tdb2.commit ();
// Create a chart, scan the tasks, then render.
Chart chart ('M');
chart.scan (filtered);
output = chart.render ();
return rc;
}
示例13: Chart
//
// Note: Called from both Apply and OK on New Chart dialog
// Must only called when the changes are definately going to
// be applied, so all input validation must be done by now.
//
Chart *PmChart::acceptNewChart()
{
bool yAutoScale;
double yMin, yMax;
QString scheme;
int sequence;
Chart *cp = new Chart(activeTab(), activeTab()->splitter());
activeGroup->addGadget(cp);
activeTab()->addGadget(cp);
QString newTitle = my.newchart->title().trimmed();
if (newTitle.isEmpty() == false)
cp->changeTitle(newTitle, true);
cp->setLegendVisible(my.newchart->legend());
cp->setAntiAliasing(my.newchart->antiAliasing());
cp->setRateConvert(my.newchart->rateConvert());
my.newchart->updateChartPlots(cp);
my.newchart->scale(&yAutoScale, &yMin, &yMax);
cp->setScale(yAutoScale, yMin, yMax);
my.newchart->scheme(&scheme, &sequence);
cp->setScheme(scheme, sequence);
activeGroup->setupWorldView();
activeTab()->showGadgets();
enableUi();
return cp;
}
示例14:
void
CrossSectionWindow::PaintAircraft(Canvas &canvas, const Chart &chart,
const PixelRect rc)
{
canvas.Select(look.aircraft_brush);
canvas.SelectNullPen();
RasterPoint line[4];
line[0].x = chart.screenX(fixed_zero);
line[0].y = chart.screenY(gps_info.nav_altitude);
line[1].x = rc.left;
line[1].y = line[0].y;
line[2].x = line[1].x;
line[2].y = line[0].y - (line[0].x - line[1].x) / 2;
line[3].x = (line[1].x + line[0].x) / 2;
line[3].y = line[0].y;
canvas.DrawTriangleFan(line, 4);
}
示例15:
void
CrossSectionWindow::PaintGlide(Chart &chart)
{
if (gps_info.GroundSpeed > fixed(10)) {
fixed t = vec.Distance / gps_info.GroundSpeed;
chart.DrawLine(fixed_zero, gps_info.NavAltitude, vec.Distance,
gps_info.NavAltitude + calculated_info.Average30s * t,
Chart::STYLE_BLUETHIN);
}
}