[x3d-public] Isolating problems with HAnimHumanoid.java and X3DUOM, etc.
John Carlson
yottzumm at gmail.com
Mon Jun 24 16:13:59 PDT 2024
I’m seeing some issues below, fixing.
On Mon, Jun 24, 2024 at 5:21 AM John Carlson <yottzumm at gmail.com> wrote:
> I will try again.
>
> Problem: setting containerField on HAnimHumanoid children nodes to
> something besides "children" or default.
>
> Constraint: do not set containerField in application code, instead use
> addSegments, addJoints.
>
> Target client code:
>
> Humanoid1.addJoints(HAnimJoint1)
>
> Implementation:
> ==================================================================
> HAnimHumanoid.java:
>
> Map<HAnimHumanoidHAnimJointContainerFieldEnum,X3DGroupingNode>
> enumToContainerField = new
> Map<HAnimHumanoidHAnimJointContainerFieldEnum,X3DGroupingNode>();
> {{
> enumToContainerField
> .put(HAnimHumanoidHAnimJointContainerFieldEnum.joints, joints);
> enumToContainerField
> .put(HAnimHumanoidHAnimJointContainerFieldEnum.skeleton, skeleton);
> }}
>
> public HAnimHumanoid addJoints(HAnimJoint joint) throw new
> ContainerFieldException {
> // the next line may throw an exception, not declared yet
> if (joint.setTypeSafeContainerField(this.getClass(),
> HAnimHumanoidHAnimJointContainerFieldEnum.joints)) {
> joints.add(joint);
>
} else {
> throw new ContainerFieldException();
> }
> return this;
> }
> ===================================================================
> HAnimJoint.java:
>
> Map<Class,Set<HAnimHumanoidHAnimJointContainerFieldEnum>>
> containerFieldMap = new
> HashMap<Class,Set<HAnimHumanoidHAnimJointContainerFieldEnum>>();
>
> public enum HAnimHumanoidHAnimJointContainerFieldEnum {
>
> joints,
>
> skeleton
>
> }
>
> Set<HAnimHumanoidHAnimJointContainerFieldEnum> cfEnumSet =
> HashSet<HAnimHumanoidHAnimJointContainerFieldEnum>()
>
> cfEnumSet.add(HAnimHumanoidHAnimJointContainerFieldEnum.joints);
> cfEnumSet.add(HAnimHumanoidHAnimJointContainerFieldEnum.skeleton);
>
> containerFieldMap.put(HAnimHumanoid.class,cfEnumSet);
>
> public boolean setTypeSafeContainerField(Class c,
> HAnimHumanoidHAnimJointContainerFieldEnum cf) {
> return containerFieldMap.get(c).get(cf);
> }
>
> I can provide more detail if asked questions.
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20240624/602c21e0/attachment-0001.html>
More information about the x3d-public
mailing list