I've been trying to add the Combined Manipulator to my model but Nothing seems to work, I use the Bind method to attached it but it doesn't show up.
Hope you can help me out.
public Impresion()
{
InitializeComponent();
ModelVisual3D device3D = new ModelVisual3D();
device3D.Content = Display3d(MODEL_PATH);
CombinedManipulator manipulator = new CombinedManipulator();
manipulator.Bind(device3D);
viewPort3d.Children.Add(device3D);
}
you are using it right,however you need to specify additional information
- you need to enable the transformations that a manipulator can perform , there is a bool property for each transformation (translation and rotation) on each plane(x,y,z) you need to enable the required transformations (CanTranslateX,....)
- set the diameter of the manipulator
Related
I am trying to create a simple MRTK application which takes inputs from Manipulator Event( Game Object and Text) and displays Gameobject with updated text on the screen.
Example: When Manipulation is started, enable the game object and update the Text. For this I want the Manipulation event to pass the game object name and string to function which enables the object and update text.
I can see the function name with one parameter.
public void showpotext(GameObject txtframe)
{
//txtpo4 = GameObject.Find("poinfotxt4");
txtpo1.GetComponent<TextMeshProUGUI>().text = stxtpo1;
txtpo2.GetComponent<TextMeshProUGUI>().text = stxtpo2;
txtpo3.GetComponent<TextMeshProUGUI>().text = stxtpo3;
txtpo4.GetComponent<TextMeshProUGUI>().text = stxtpo4;
txtframe.SetActive(true);
}
It works for the above code, I can see the function name in the Manipulator event.
But If I add one more parameter to my function, I am not able to see the Function name.
public void showpotext(GameObject txtframe, string updatedtext)
{
//txtpo4 = GameObject.Find("poinfotxt4");
//txtpo1.GetComponent<TextMeshProUGUI>().text = stxtpo1;
//txtpo2.GetComponent<TextMeshProUGUI>().text = stxtpo2;
//txtpo3.GetComponent<TextMeshProUGUI>().text = stxtpo3;
txtpo4.GetComponent<TextMeshProUGUI>().text = updatedtext;
txtframe.SetActive(true);
}
}
Am I doing anything wrong?
Regards,
I have a Ruta rule that looks something like this, where dep is a DKPro imported Dependency type.
dep{}->{MyItem{->
SETFEATURE("Display", "displayedValue"),
SETFEATURE("Lemma", dep.Dependent.lemma.value),
SETFEATURE("Parent", dep.Governor)};};
The first two actions work. The problem I have is in the third action SETFEATURE("Parent", dep.Governor). dep.Governor returns a Token type but my feature requires another type that happens to share the same location as the Governor. In other words I want my own type, not dep.Governor, that has already annotated that governing word.
I am unsure how to recover an annotation (my annotation) that occupies the same space as the dep.Governor. Ideally I would like to recover it as a variable so that I can reuse it for other features to do something like this.
a:MyItem [that overlaps dep.Governor]
dep{}->{MyItem{->SETFEATURE("Parent", a)};};
Here is a more precise example
d:dep.Dependency{->
MyItem,
MyItem.Display = "Ignore",
MyItem.Lemma = d.Dependent.lemma.value,
MyItem.LanguageParent = d,
};
The line MyItem.LanguageParent = d produces this Ruta error
Trying to access value of feature "type.MyItem:LanguageParent" as "type.MyItem", but range of feature is "de.tudarmstadt.ukp.dkpro.core.api.syntax.type.dependency.Dependency"
I am sure there is a cleaner way than this, but for now, I am converting the type using a block function and saving it into an annotation variable.
BLOCK(ConvertTokenToMyItem) Token{IS(MyItem)} {
varMyItem:MyItem;
}
Then I use it
d:dep.Dependency{->
MyItem,
MyItem.Display = "Ignore",
MyItem.Lemma = d.Dependent.lemma.value,
MyItem.LanguageParent = varMyItem,
};
I want to store an initial value when an object is loaded in a private property. If I change the value later on I want to be able to compare the initial and the current value. I can't find a suitable event for capturing the initial value. Should be just after loading the object... OnAfterCreate does not do the trick..
I could propably also use the PropertyChanged event but I am not sure how to implement it..
It was OnAfterReadRecord indeed. Thanks Simon!
protected void OnAfterReadRecord(System.Data.IDataReader reader,
CodeFluent.Runtime.CodeFluentReloadOptions options)
{
_initialActive = CodeFluentPersistence.GetReaderValue(reader, "CwObject_Active",
((bool)(false)));
}
I have a class called UFDevice, in order to initialise it needs a location string.
I also have a class called UFResponse which among other things provides a location.
As the device only requires a location should I just take that in, so that it could be init'ed in some use case where there is no UFResponse.
Or should I pass in the whole response, in case later on it needs more info than just the location?
in pseudocode:
foundDevice(Data data) {
response = new UFResponse(data);
device = new UFDevice(response);
}
or:
foundDevice(Data data) {
response = new UFResponse(data);
device = new UFDevice(response.location);
}
or even should I encapsulate UFResponse in UFDevice, as currently it's only used to create UFDevices:
foundDevice(Data data) {
device = new UFDevice(data);
}
Future possibilities could include:
//maybe in the future I have saved a favourite location so need to do:
loadFavourite(String location) {
device = new UFDevice(location);
}
//or device needs more info
device = new UFDevice(location, color, ...20 more parameters...);
Where do I draw the line of separation? More importantly how can I decide this for myself in the future?
It sounds like a problem of interface segragation (https://en.wikipedia.org/wiki/Interface_segregation_principle). UFDevice is constructed from a UFResponse, but it doesn't need everything the UFResponse contains. It only needs a part of it, and you don't want UFDevice to be affected when UFResponse is changing in areas that should not affect UFDevice.
One approach is to have UFResponse inherit from an interface called UFDeviceParams, if this makes sense (might be multiple inheritance), and then UFDevice should get in its constructor a reference to UFDeviceParams.
This allows to initialize UFDevice based on the entire UFResponse, or based on a more light-weight instance of UFFavouriteParams (that also inherits from UFDeviceParams) that contains only the location + color etc...
foundDevice(Data data) {
response = new UFResponse(data);
device = new UFDevice(response);
}
loadFavourite(String location) {
params = new UFFavouriteParams(location);
device = new UFDevice(params);
}
To really know if this is the best approach for your case, one would need to learn more about your system, understand the use cases and the boundaries between modules. I recommend to watch Robert Martin's video on the Interface Segratation Principle and SOLID principles in general (https://cleancoders.com/category/solid-principles)
I'd like to set the background colour of fields and methods (on the first level) according to their visibility modifier in Eclipse.
For example private fields and methods should get a red background, while public fields and methods get a green background:
Is there a way to configure this in Eclipse?
To get this sort of a colored background, you need to use Markers and MarkerAnnotationSpecification. You will find how to use them here: http://cubussapiens.hu/2011/05/custom-markers-and-annotations-the-bright-side-of-eclipse/
As for how to find the private, public fields, you need to use the JDT plugin and the AST parser to parse the Java file and find all the information that you want. I am adding a small code snippet to get you started on this.
ASTParser parser = ASTParser.newParser(AST_LEVEL);
parser.setSource(cmpUnit);
parser.setResolveBindings(true);
CompilationUnit astRoot = (CompilationUnit) parser.createAST(null);
AST ast = astRoot.getAST();
TypeDeclaration javaType = null;
Object type = astRoot.types().get(0);
if (type instanceof TypeDeclaration) {
javaType = ((TypeDeclaration) type);
}
List<FieldDeclarationInfo> fieldDeclarations = new ArrayList<FieldDeclarationInfo>();
// Get the field info
for (FieldDeclaration fieldDeclaration : javaType.getFields()) {
// From this object you can recover all the information that you want about the fields.
}
Here cmpUnit is the ICompilationUnit of the Java File.