Skip to content

Commit e6adfc5

Browse files
IKhonakhbeevaiakov
andauthored
Add markerUp and markerDown generation on TRIK model (#861)
* Add markerUp and markerDown generation on TRIK model * Updare copyrights Co-Authored-By: iakov <iakov@users.noreply.github.com> Co-authored-by: iakov <iakov@users.noreply.github.com>
1 parent d9f6fd7 commit e6adfc5

File tree

13 files changed

+153
-4
lines changed

13 files changed

+153
-4
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* Copyright 2020, CyberTech Labs Ltd.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License. */
14+
15+
#include "markerDownGenerator.h"
16+
17+
#include <generatorBase/generatorCustomizer.h>
18+
#include "src/converters/backgroundColorConverter.h"
19+
20+
using namespace trik::simple;
21+
using namespace trik::converters;
22+
using namespace generatorBase::simple;
23+
24+
MarkerDownGenerator::MarkerDownGenerator(const qrRepo::RepoApi &repo
25+
, generatorBase::GeneratorCustomizer &customizer
26+
, const qReal::Id &id
27+
, QObject *parent)
28+
: BindingGenerator(repo, customizer, id
29+
, "markerDown.t"
30+
, { Binding::createConverting("@@COLOR@@", "Color"
31+
, new BackgroundColorConverter(customizer.factory()->pathsToTemplates()))
32+
// , customizer.factory()->stringPropertyConverter(id, "Color"))
33+
}, parent)
34+
{
35+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/* Copyright 2020, CyberTech Labs Ltd.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License. */
14+
15+
#pragma once
16+
17+
#include <generatorBase/simpleGenerators/bindingGenerator.h>
18+
19+
namespace trik {
20+
namespace simple {
21+
22+
/// Generator for 'SetBackground' block.
23+
class MarkerDownGenerator : public generatorBase::simple::BindingGenerator
24+
{
25+
public:
26+
MarkerDownGenerator(const qrRepo::RepoApi &repo
27+
, generatorBase::GeneratorCustomizer &customizer
28+
, const qReal::Id &id
29+
, QObject *parent);
30+
};
31+
32+
}
33+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* Copyright 2020, CyberTech Labs Ltd.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License. */
14+
15+
#include "markerUpGenerator.h"
16+
17+
#include <generatorBase/generatorCustomizer.h>
18+
#include "src/converters/backgroundColorConverter.h"
19+
20+
using namespace trik::simple;
21+
using namespace trik::converters;
22+
using namespace generatorBase::simple;
23+
24+
MarkerUpGenerator::MarkerUpGenerator(const qrRepo::RepoApi &repo
25+
, generatorBase::GeneratorCustomizer &customizer
26+
, const qReal::Id &id
27+
, QObject *parent)
28+
: BindingGenerator(repo, customizer, id, "markerUp.t", QList<Binding *>(), parent)
29+
{
30+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/* Copyright 2020, CyberTech Labs Ltd.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License. */
14+
15+
#pragma once
16+
17+
#include <generatorBase/simpleGenerators/bindingGenerator.h>
18+
19+
namespace trik {
20+
namespace simple {
21+
22+
/// Generator for 'SetBackground' block.
23+
class MarkerUpGenerator : public generatorBase::simple::BindingGenerator
24+
{
25+
public:
26+
MarkerUpGenerator(const qrRepo::RepoApi &repo
27+
, generatorBase::GeneratorCustomizer &customizer
28+
, const qReal::Id &id
29+
, QObject *parent);
30+
};
31+
32+
}
33+
}

plugins/robots/generators/trik/trikGeneratorBase/src/trikGeneratorFactory.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
#include "simpleGenerators/waitPadPressGenerator.h"
5151
#include "simpleGenerators/fileWriteGenerator.h"
5252
#include "simpleGenerators/removeFileGenerator.h"
53+
#include "simpleGenerators/markerDownGenerator.h"
54+
#include "simpleGenerators/markerUpGenerator.h"
5355
#include "parts/trikDeviceVariables.h"
5456

5557
using namespace trik;
@@ -142,6 +144,10 @@ AbstractSimpleGenerator *TrikGeneratorFactory::simpleGenerator(const qReal::Id &
142144
return new FileWriteGenerator(mRepo, customizer, id, this);
143145
} else if (elementType == "TrikRemoveFile") {
144146
return new RemoveFileGenerator(mRepo, customizer, id, this);
147+
} else if (elementType == "MarkerDown") {
148+
return new MarkerDownGenerator(mRepo, customizer, id, this);
149+
} else if (elementType == "MarkerUp") {
150+
return new MarkerUpGenerator(mRepo, customizer, id, this);
145151
}
146152

147153
return GeneratorFactoryBase::simpleGenerator(id, customizer);

plugins/robots/generators/trik/trikGeneratorBase/trikGeneratorBase.pro

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ HEADERS += \
7979
$$PWD/src/simpleGenerators/fileWriteGenerator.h \
8080
$$PWD/src/simpleGenerators/removeFileGenerator.h \
8181
$$PWD/src/simpleGenerators/stopCameraGenerator.h \
82-
$$PWD/src/simpleGenerators/stopVideoStreamingGenerator.h
82+
$$PWD/src/simpleGenerators/stopVideoStreamingGenerator.h \
83+
$$PWD/src/simpleGenerators/markerDownGenerator.h \
84+
$$PWD/src/simpleGenerators/markerUpGenerator.h \
8385

8486
SOURCES += \
8587
$$PWD/src/trikBlocksValidator.cpp \
@@ -123,4 +125,6 @@ SOURCES += \
123125
$$PWD/src/simpleGenerators/fileWriteGenerator.cpp \
124126
$$PWD/src/simpleGenerators/removeFileGenerator.cpp \
125127
$$PWD/src/simpleGenerators/stopCameraGenerator.cpp \
126-
$$PWD/src/simpleGenerators/stopVideoStreamingGenerator.cpp
128+
$$PWD/src/simpleGenerators/stopVideoStreamingGenerator.cpp \
129+
$$PWD/src/simpleGenerators/markerDownGenerator.cpp \
130+
$$PWD/src/simpleGenerators/markerUpGenerator.cpp \

plugins/robots/generators/trik/trikPythonGeneratorLibrary/templates.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,5 +232,7 @@
232232
<file>templates/videosensors/stopobjectSensor.t</file>
233233
<file>templates/videosensors/stopVideoStreaming.t</file>
234234
<file>templates/wait/gyroscope.t</file>
235+
<file>templates/markerDown.t</file>
236+
<file>templates/markerUp.t</file>
235237
</qresource>
236238
</RCC>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
brick.marker().down("@@COLOR@@")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
brick.marker().up()

plugins/robots/generators/trik/trikQtsGeneratorLibrary/templates.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,5 +237,7 @@
237237
<file>templates/switch/middle_switch.t</file>
238238
<file>templates/switch/oneCase_switch.t</file>
239239
<file>templates/wait/gyroscope.t</file>
240+
<file>templates/markerDown.t</file>
241+
<file>templates/markerUp.t</file>
240242
</qresource>
241243
</RCC>

0 commit comments

Comments
 (0)