001/* 002 * TransformChangeEvent -- A listener for changes to a transform. 003 * 004 * Copyright (C) 2009-2023, by Joseph A. Huwaldt 005 * All rights reserved. 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * You should have received a copy of the GNU Lesser General Public License 018 * along with this program; if not, write to the Free Software 019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 020 * Or visit: http://www.gnu.org/licenses/lgpl.html 021 */ 022package jahuwaldt.j3d; 023 024import java.util.EventObject; 025import static java.util.Objects.requireNonNull; 026import org.jogamp.java3d.Transform3D; 027 028/** 029 * An even that represents a change in a transform. 030 * 031 * <p> Modified by: Joseph A.Huwaldt </p> 032 * 033 * @author Joseph A. Huwaldt, Date: April 14, 2009 034 * @version June 4, 2023 035 */ 036public class TransformChangeEvent extends EventObject { 037 038 private static final long serialVersionUID = 1L; 039 040 /** 041 * The type of change that has been made to the transform. 042 */ 043 public enum Type { 044 045 ROTATE, 046 TRANSLATE, 047 ZOOM; 048 } 049 050 // The type of change this event represents. 051 private final Type _type; 052 053 // The transform after the change occured. 054 private final Transform3D _transform; 055 056 /** 057 * Construct a new event using the specified source, type code and transform. 058 * 059 * @param source The source of the change in the transform. 060 * @param type The type code for the change as enumerated in this class. 061 * @param transform The new transform after the change. 062 */ 063 public TransformChangeEvent(Object source, Type type, Transform3D transform) { 064 super(requireNonNull(source, "source == null")); 065 _type = requireNonNull(type, "type == null"); 066 _transform = requireNonNull(transform, "transform == null"); 067 } 068 069 /** 070 * Return the type of transform. 071 * 072 * @return The type of the transform. 073 */ 074 public Type getType() { 075 return _type; 076 } 077 078 /** 079 * Return the new transformation matrix. 080 * 081 * @return The new transformation matrix. 082 */ 083 public Transform3D getTransform() { 084 return _transform; 085 } 086 087}