Exemplo n.º 1
0
const HRESULT CPVI_Canvas::Init(const char* name/*=0*/)
{
    char temp[MAX_PATH];
    _snprintf_s(temp, MAX_PATH, _TRUNCATE, "%s.blind", _strconf);
    _bHasBackground = _config->getBool(temp);

    IGlyph* g = 0;
    if (_bHasBackground) {
        _blind = new CBlind(_name, BGR(0, 0, 0), 0.5);
        g = AppendChild(_gt.begin(), _blind);
    }

    try {
        //_my_disp;
        char temp[MAX_PATH];
        _snprintf_s(temp, MAX_PATH, "%s.containers", this->_strconf);
        strcpy_s(_my_cont, MAX_PATH, _config->getString(temp).c_str());

        _snprintf_s(temp, MAX_PATH, _TRUNCATE, "%s.rect-percentage", _strconf);
        _config->getTripleFloat(_tt_layout, temp);

        _snprintf_s(temp, MAX_PATH, _TRUNCATE, "%s.margin",          _strconf);
        _config->getRect(_margin, temp);

        _snprintf_s(temp, MAX_PATH, _TRUNCATE, "%s.chart-interval", _strconf);
        _chart_interval = _config->getInt(temp);
        _prc_chart = new CPriceTickChart("price-chart");
        _snprintf_s(temp, MAX_PATH, "%s.price-chart", _strconf);
        _prc_chart->setConfig(_config, temp);
        if (!g)
            g = AppendChild(_gt.begin(), _prc_chart);
        else
            g = InsertNext(g->GetGlyphTreeIter(), _prc_chart);
        _prc_chart->AddGraphs();

        _vol_chart = new CVolumeTickChart("volume-chart");
        _snprintf_s(temp, MAX_PATH, "%s.volume-chart", _strconf);
        _vol_chart->setConfig(_config, temp);
        g = InsertNext(g->GetGlyphTreeIter(), _vol_chart);
        _vol_chart->AddGraphs();

        _itr_chart = new CInterestTickChart("interest-chart");
        _snprintf_s(temp, MAX_PATH, "%s.interest-chart", _strconf);
        _itr_chart->setConfig(_config, temp);
        g = InsertNext(g->GetGlyphTreeIter(), _itr_chart);
        _itr_chart->AddGraphs();
    } catch(...) {
        return (-1);
    }
    return S_OK;
}
Exemplo n.º 2
0
bool LinkedList<T>::InsertNode(Node<T>* pNewNode, int position)
{
    if (position == 1) //insert to the head position
    {
        pNewNode->next = mHead;
        mHead = pNewNode;
        return true;
    }
    
    Node<T>* pCurrNode = FindNodeByPosition(position - 1);
    if (pCurrNode == nullptr)
    {
        cout << "ERROR Node can't be added" << endl;
        return false;
    }

    InsertNext(pCurrNode, pNewNode);
    return true;
}
Exemplo n.º 3
0
const HRESULT CEuclidCanvas::Init(const char* name/* = 0*/)
{
    IGlyph* g = 0;
    if (_bHasBackground) {
        _blind = new CBlind(_name, BGR(0, 0, 0), 0.8);
        g = AppendChild(_gt.begin(), _blind);
    }

    try {
        //_my_disp;
        char temp[MAX_PATH];
        _snprintf_s(temp, MAX_PATH, "%s.containers", this->_strconf);
        strcpy_s(_my_cont, MAX_PATH, _config->getString(temp).c_str());

        _prc_chart = new CPriceTickChart("price-chart");
        _snprintf_s(temp, MAX_PATH, "%s.price-chart", _strconf);
        _prc_chart->setConfig(_config, temp);
        if (!g)
            g = AppendChild(_gt.begin(), _prc_chart);
        else
            g = InsertNext(g->GetGlyphTreeIter(), _prc_chart);
        _prc_chart->AddGraphs();

        _approx_short_lo = new CDataLineGraph("rt-appx_short_lo", CDataLineGraph::GEOMETRY_PATH_TYPE_LINE, false, false);
        _approx_short_lo->setWorld(_prc_chart->getCoordWorld());
        _approx_short_lo->SetLineColor(BGR(255, 0, 0), 1.0f);
        _approx_short_lo->SetStrokeWidth(.02f);
        _approx_short_lo->GetGraphData()->SetSize(1024);
        g = InsertNext(g->GetGlyphTreeIter(), _approx_short_lo);

        _approx_short_he = new CDataLineGraph("rt-appx_short_he", CDataLineGraph::GEOMETRY_PATH_TYPE_LINE, false, false);
        _approx_short_he->setWorld(_prc_chart->getCoordWorld());
        _approx_short_he->SetLineColor(BGR(0, 255, 0), 1.0f);
        _approx_short_he->SetStrokeWidth(.02f);
        _approx_short_he->GetGraphData()->SetSize(1024);
        g = InsertNext(g->GetGlyphTreeIter(), _approx_short_he);

        _approx_long_lo = new CDataLineGraph("rt-appx_long_lo", CDataLineGraph::GEOMETRY_PATH_TYPE_LINE, false, false);
        _approx_long_lo->setWorld(_prc_chart->getCoordWorld());
        _approx_long_lo->SetLineColor(BGR(255, 0, 0), 1.0f);
        _approx_long_lo->SetStrokeWidth(.1f);
        _approx_long_lo->GetGraphData()->SetSize(1024);
        g = InsertNext(g->GetGlyphTreeIter(), _approx_long_lo);

        _approx_long_he = new CDataLineGraph("rt-appx_long_he", CDataLineGraph::GEOMETRY_PATH_TYPE_LINE, false, false);
        _approx_long_he->setWorld(_prc_chart->getCoordWorld());
        _approx_long_he->SetLineColor(BGR(0, 255, 0), 1.0f);
        _approx_long_he->SetStrokeWidth(.1f);
        _approx_long_he->GetGraphData()->SetSize(1024);
        g = InsertNext(g->GetGlyphTreeIter(), _approx_long_he);

        _predict_short_lo = new CDataLineGraph("rt-prdt_short_lo", CDataLineGraph::GEOMETRY_PATH_TYPE_LINE, false, false);
        _predict_short_lo->setWorld(_prc_chart->getCoordWorld());
        _predict_short_lo->SetLineColor(BGR(255, 0, 0), 1.0f);
        _predict_short_lo->SetStrokeWidth(.2f);
        _predict_short_lo->GetGraphData()->SetSize(180);
        g = InsertNext(g->GetGlyphTreeIter(), _predict_short_lo);

        _predict_short_he = new CDataLineGraph("rt-prdt_short_he", CDataLineGraph::GEOMETRY_PATH_TYPE_LINE, false, false);
        _predict_short_he->setWorld(_prc_chart->getCoordWorld());
        _predict_short_he->SetLineColor(BGR(0, 255, 0), 1.0f);
        _predict_short_he->SetStrokeWidth(.2f);
        _predict_short_he->GetGraphData()->SetSize(180);
        g = InsertNext(g->GetGlyphTreeIter(), _predict_short_he);

        _predict_long_lo = new CDataLineGraph("rt-prdt_long_lo", CDataLineGraph::GEOMETRY_PATH_TYPE_LINE, false, false);
        _predict_long_lo->setWorld(_prc_chart->getCoordWorld());
        _predict_long_lo->SetLineColor(BGR(255, 0, 0), 1.0f);
        _predict_long_lo->SetStrokeWidth(.2f);
        _predict_long_lo->GetGraphData()->SetSize(180);
        g = InsertNext(g->GetGlyphTreeIter(), _predict_long_lo);

        _predict_long_he = new CDataLineGraph("rt-prdt_long_he", CDataLineGraph::GEOMETRY_PATH_TYPE_LINE, false, false);
        _predict_long_he->setWorld(_prc_chart->getCoordWorld());
        _predict_long_he->SetLineColor(BGR(255, 0, 0), 1.0f);
        _predict_long_he->SetStrokeWidth(.2f);
        _predict_long_he->GetGraphData()->SetSize(180);
        g = InsertNext(g->GetGlyphTreeIter(), _predict_long_he);
    } catch(...) {
        return (-1);
    }
    return S_OK;
}