1 /***************************************************************************
3 * Copyright 2010,2011 BMW Car IT GmbH
4 * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ****************************************************************************/
20 #include "ScreenSetRenderOrderCommand.h"
21 #include "ICommandExecutor.h"
25 ScreenSetRenderOrderCommand::~ScreenSetRenderOrderCommand()
30 ExecutionResult ScreenSetRenderOrderCommand::execute(ICommandExecutor* executor)
32 Scene& scene = *(executor->getScene());
33 ExecutionResult result = ExecutionFailed;
36 for (unsigned int i = 0; i < m_length; i++)
38 for (unsigned int c = i + 1; c < m_length; c++)
40 if (m_array[i] == m_array[c])
42 // doubles not allowed here
43 return ExecutionFailed;
48 // taken out because other software currently expects partial execution of command,
49 // i.e. the layers that exist are added to the render order
51 // // check that all layers to be added exist
52 // for (unsigned int i=0;i<length;i++){
53 // Layer* l = layerlist.getLayer(array[i]);
56 // } // TODO insert again later
58 if (scene.getCurrentRenderOrder(m_screenID).size() != 0)
60 IRenderer* renderer = *((executor->getRendererList())->begin());
61 renderer->forceCompositionWindowSystem();
62 result = ExecutionSuccessRedraw;
65 scene.getCurrentRenderOrder(m_screenID).clear();
67 LOG_DEBUG("ScreenSetRenderOrderCommand", "Length to set: " << m_length);
71 result = ExecutionSuccessRedraw;
74 for (unsigned int i = 0; i < m_length; i++)
76 LOG_DEBUG("ScreenSetRenderOrderCommand", "Trying to add layer: " << m_array[i] << " to current render order");
77 Layer* layer = scene.getLayer(m_array[i]);
80 LOG_DEBUG("ScreenSetRenderOrderCommand", "Adding Layer: " << m_array[i] << " to current render order");
81 scene.getCurrentRenderOrder(m_screenID).push_back(layer);
82 result = ExecutionSuccessRedraw;
89 const std::string ScreenSetRenderOrderCommand::getString()
91 std::stringstream description;
92 description << "ScreenSetRenderOrderCommand("
93 << "m_screenID=" << m_screenID << "(0x" << std::hex << m_screenID << ")" << std::dec
96 for (unsigned int i = 0; i < m_length; ++i)
98 description << m_array[i] << ",";
100 description << "], m_length=" << m_length
102 return description.str();