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


C++ Model::GetNumStrings方法代码示例

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


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

示例1: SetOutputs


//.........这里部分代码省略.........

        // for each port ... this is the max of any port type but it should be ok
        for (int i = 1; i <= maxport; i++)
        {
            // find the first and last
            Model* first = nullptr;
            Model* last = nullptr;
            int highestend = 0;
            long loweststart = 999999999;

            for (auto model = models.begin(); model != models.end(); ++model)
            {
                if ((*model)->GetProtocol() == *protocol && (*model)->GetPort() == i)
                {
                    int modelstart = (*model)->GetNumberFromChannelString((*model)->ModelStartChannel);
                    int modelend = modelstart + (*model)->GetChanCount() - 1;
                    if (modelstart < loweststart)
                    {
                        loweststart = modelstart;
                        first = *model;
                    }
                    if (modelend > highestend)
                    {
                        highestend = modelend;
                        last = *model;
                    }
                }
            }

            if (first != nullptr)
            {
                int portstart = first->GetNumberFromChannelString(first->ModelStartChannel);
                int portend = last->GetNumberFromChannelString(last->ModelStartChannel) + last->GetChanCount() - 1;
                int numstrings = first->GetNumStrings();
                bool multistringelement = (first->GetDisplayAs() == "Matrix" || 
                    first->GetDisplayAs() == "Tree" ||
                    first->GetDisplayAs() == "Circle" ||
                    first->GetDisplayAs() == "Star" ||
                    first->GetDisplayAs() == "Wreath" ||
                    first->GetDisplayAs() == "Icicles");
                int channelsperstring = first->NodesPerString() * first->GetChanCountPerNode();
                // upload it
                if (DecodeStringPortProtocol(*protocol) >= 0)
                {
                    if (first == last && numstrings > 1 && multistringelement)
                    {
                        for (int j = 0; j < numstrings; j++)
                        {
                            if (portdone[i+j])
                            {
                                logger_base.warn("Falcon Outputs Upload: Attempt to upload model %s to string port %d but this string port already has a model on it.", (const char *)first->GetName().c_str(), i +j);
                                wxMessageBox(wxString::Format("Attempt to upload model %s to string port %d but this string port already has a model on it.", (const char *)first->GetName().c_str(), i + j));
                            }
                            else
                            {
                                portdone[i + j] = true;
                                count++;
                                if (sendmessage != "") sendmessage = sendmessage + "&";
                                sendmessage = sendmessage + BuildStringPort(strings, i + j, DecodeStringPortProtocol(*protocol), portstart + j * channelsperstring, channelsperstring / 3, first->GetName(), parent);
                                if (count == 40)
                                {
                                    UploadStringPort(sendmessage, false);
                                    sendmessage = "";
                                    count = 0;
                                }
                            }
开发者ID:,项目名称:,代码行数:67,代码来源:


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